Anyone else had trouble with directory listing?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Anyone else had trouble with directory listing?

Post by turkeyman »

heres a snip of code:

Code: Select all

SceIoDirent findData;
int findStatus;

SceUID hFind = sceIoDopen(pFindPattern);
DBGASSERT(hFind >= 0, "Couldnt start find..");

findStatus = sceIoDread(hFind, &findData);

DBGASSERT(false, STR("hmmmm %d.. i crash before i ever get here...", findStatus));
any ideas?
this is correct usage right?

when it calls sceIoDread(), it locks up and then turns the PSP off...
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

It gets unhappy if findData is on the stack. Make it a global and it works ok. I found this out by trial and error. I have no idea why it works this way.

JimS
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

hahaha...
wow....
....

thats....


bent :P


cool thanks heaps man!!!
User avatar
turkeyman
Posts: 75
Joined: Wed Oct 20, 2004 7:38 pm
Location: Brisbane, Australia
Contact:

Post by turkeyman »

and i've immediately hit another wall....

that function now succeeds... the first file it returns is '.' .. then i call the function again, and it returns 0 (no more files?) ..

the directory is definately populated.. and i can open files and read them directly.. they just dont seem to show in the directory listing.. :/

an interesting behaviour i found is, if i search on a path with a '/' on the end, the file it finds is named '.' .. if i search on a path without the '/' .. the file it returns is named '/.' .. this seems weird to me ... i'll keep playing with it..
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

Actually, you have to memset() the dirent before calling sceIoDread(). Then it works on stack or global.
User avatar
Jim
Posts: 476
Joined: Sat Jul 02, 2005 10:06 pm
Location: Sydney
Contact:

Post by Jim »

Interesting you say that, because you are able to use the same buffer over and over again with only setting dir.file[0]='\0' (emptying the filename) without memsets in between, but that doesn't work on its own.
Just luck I suppose.

Jim
Post Reply