• Steam recently changed the default privacy settings for all users. This may impact tracking. Ensure your profile has the correct settings by following the guide on our forums.

Directory Listing

papa.japizzle

New Member
How does one get a list of the files in a directory on the PSP? Does readdir() work, or is there some Sony way in the SDK?

Also, unrelated: Is the difference between different kernel version homebrews the syscalls? I've been reading around a bit and I can't say I've come across anything more detailed than "it doesn't work", so I'm kinda curious as to how incompatible it is.

Cheers,

PapaJ
 
Something like this might work:

Code:
int dl = sceIoDopen(/* DIRECTORY PATH */);
if(dl < 0){return;}

SceIoDirent sid;
memset(&sid, 0, sizeof(SceIoDirent));

while(sceIoDread(dl, &sid)){
	if(sid.d_name[0] == '.'){continue;}

	char filepath[256];
	sprintf(filepath, "%s/%s", dir, sid.d_name);
	
	if(FIO_S_ISDIR(sid.d_stat.st_mode)){
		// if it is a directory do this stuff
	}
	else{
		// if file do this
	}

	memset(&sid, 0, sizeof(SceIoDirent));
}

sceIoDclose(dl);
 
Thanks both of you, that (on both fronts) looks like what I was looking for. Once I get some more free time I'll give that source a proper comb through and start experimenting.

Cheers.
 
Back
Top