| View previous topic :: View next topic |
| Author |
Message |
sturatt
Joined: 13 Jul 2006 Posts: 46
|
Posted: Thu Jul 13, 2006 4:23 pm Post subject: get files and subfolders in a directory [resolved] |
|
|
Can anyone help me with going about listing all the files/folders in a directory? I've searched for about an hour.. maybe I'm not searching for the rigtht thing..
I would appreciate any help.
In case this isnt clear, i just want to be able to know what files and folders are in a certian directory.
Last edited by sturatt on Sun Jul 30, 2006 4:27 am; edited 1 time in total |
|
| Back to top |
|
 |
the_darkside_986
Joined: 18 Jul 2006 Posts: 9
|
Posted: Sat Jul 29, 2006 2:20 pm Post subject: me too |
|
|
| I'm having the same trouble finding information about this. I know it's possible because emulators do it. Maybe I should find the source for those and look. I really have an idea of a nice homebrew app that would require the ability to list and select files. |
|
| Back to top |
|
 |
sg57
Joined: 14 Oct 2005 Posts: 154
|
Posted: Sat Jul 29, 2006 3:57 pm Post subject: |
|
|
Its very simple to list all the files in a directory, but to save you the extra questions if i posted it, ill just point you to an example of a filebrowser, included with the answre you asked...
Its made by slasher, at PSPU, the thread is Slasher's dump (lol)... I faintly remember seeing a filebrowser example posted... |
|
| Back to top |
|
 |
sturatt
Joined: 13 Jul 2006 Posts: 46
|
Posted: Sun Jul 30, 2006 4:25 am Post subject: |
|
|
| hmm i figured this out a while ago, guess i should have put resolved in the title... sorry |
|
| Back to top |
|
 |
the_darkside_986
Joined: 18 Jul 2006 Posts: 9
|
Posted: Sun Jul 30, 2006 3:38 pm Post subject: |
|
|
| Could someone post a link? I can't find where that is on google search. |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
Posted: Sun Jul 30, 2006 5:41 pm Post subject: |
|
|
| Code: |
SceIoDirent dir;
int dfd, ok;
char path[]="folder";
dfd = sceIoDopen(path);
if (dfd>=0)
{
for (;;)
{
memset(&dir, 0, sizeof dir);
ok = sceIoDread(dfd, &dir);
if (ok<0) break;
//extract info from dir
}
sceIoDclose(dfd);
}
|
<edited: SceIoDirent>
Jim _________________ http://www.dbfinteractive.com
Last edited by Jim on Tue Aug 01, 2006 8:19 am; edited 1 time in total |
|
| Back to top |
|
 |
the_darkside_986
Joined: 18 Jul 2006 Posts: 9
|
Posted: Tue Aug 01, 2006 5:30 am Post subject: |
|
|
| Awesome thanks. But what are the members of the directory struct? I grepped the sdk/include files for sceIoDirent but couldn't find anything. I found the file that contains the prototype for sceIoDopen but that didn't help me. Am I looking in the wrong sdk folder (the one that contains pspkernel.h, pspctrl.h etc.)? |
|
| Back to top |
|
 |
Drakonite Site Admin

Joined: 17 Jan 2004 Posts: 989
|
Posted: Tue Aug 01, 2006 5:46 am Post subject: |
|
|
It's SceIoDirent, not sceIoDirent. _________________ Shoot Pixels Not People!
Makeshift Development |
|
| Back to top |
|
 |
Slasher
Joined: 27 Jan 2006 Posts: 5
|
|
| Back to top |
|
 |
sturatt
Joined: 13 Jul 2006 Posts: 46
|
Posted: Tue Aug 01, 2006 8:24 am Post subject: |
|
|
| god, you know what i love? i post this question on the 13th... no replies for 16 days, then the only reply is someone else asking the same question... in the same thread... and gets 7 replies in 3 days -_- oh how forums love me |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
|
| Back to top |
|
 |
Raphael

Joined: 17 Jan 2006 Posts: 646 Location: Germany
|
Posted: Wed Aug 02, 2006 12:54 am Post subject: |
|
|
Hehe, apparently, that's the way forums work :) Quicker replies are only to be expected on instant messengers/IRC
PS: Sometimes Murphy strikes somewhat too, but oh well, could be worse, couldn't it? :P _________________ <Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
Alexander Berl |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Tue Aug 08, 2006 9:35 am Post subject: |
|
|
That sample should have "ok<=0" instead of "ok<0". Giving you:
| Code: |
SceIoDirent dir;
int dfd, ok;
char path[]="folder";
dfd = sceIoDopen(path);
if (dfd>=0)
{
for (;;)
{
memset(&dir, 0, sizeof dir);
ok = sceIoDread(dfd, &dir);
if (ok<=0) break;
//extract info from dir
}
sceIoDclose(dfd);
} |
|
|
| Back to top |
|
 |
|