| View previous topic :: View next topic |
| Author |
Message |
turkeyman

Joined: 20 Oct 2004 Posts: 75 Location: Brisbane, Australia
|
Posted: Wed Jul 13, 2005 10:27 pm Post subject: Anyone else had trouble with directory listing? |
|
|
heres a snip of code:
| Code: | 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... |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Wed Jul 13, 2005 10:35 pm Post subject: |
|
|
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 _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
turkeyman

Joined: 20 Oct 2004 Posts: 75 Location: Brisbane, Australia
|
Posted: Wed Jul 13, 2005 11:17 pm Post subject: |
|
|
hahaha...
wow....
....
thats....
bent :P
cool thanks heaps man!!! |
|
| Back to top |
|
 |
turkeyman

Joined: 20 Oct 2004 Posts: 75 Location: Brisbane, Australia
|
Posted: Wed Jul 13, 2005 11:43 pm Post subject: |
|
|
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.. |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Thu Jul 14, 2005 2:04 am Post subject: |
|
|
| Actually, you have to memset() the dirent before calling sceIoDread(). Then it works on stack or global. |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Thu Jul 14, 2005 8:31 am Post subject: |
|
|
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 _________________ http://www.dbfinteractive.com |
|
| Back to top |
|
 |
|