forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

get files and subfolders in a directory [resolved]

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
sturatt



Joined: 13 Jul 2006
Posts: 46

PostPosted: Thu Jul 13, 2006 4:23 pm    Post subject: get files and subfolders in a directory [resolved] Reply with quote

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
View user's profile Send private message
the_darkside_986



Joined: 18 Jul 2006
Posts: 9

PostPosted: Sat Jul 29, 2006 2:20 pm    Post subject: me too Reply with quote

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
View user's profile Send private message
sg57



Joined: 14 Oct 2005
Posts: 154

PostPosted: Sat Jul 29, 2006 3:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
sturatt



Joined: 13 Jul 2006
Posts: 46

PostPosted: Sun Jul 30, 2006 4:25 am    Post subject: Reply with quote

hmm i figured this out a while ago, guess i should have put resolved in the title... sorry
Back to top
View user's profile Send private message
the_darkside_986



Joined: 18 Jul 2006
Posts: 9

PostPosted: Sun Jul 30, 2006 3:38 pm    Post subject: Reply with quote

Could someone post a link? I can't find where that is on google search.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sun Jul 30, 2006 5:41 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
the_darkside_986



Joined: 18 Jul 2006
Posts: 9

PostPosted: Tue Aug 01, 2006 5:30 am    Post subject: Reply with quote

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
View user's profile Send private message
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Tue Aug 01, 2006 5:46 am    Post subject: Reply with quote

It's SceIoDirent, not sceIoDirent.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Slasher



Joined: 27 Jan 2006
Posts: 5

PostPosted: Tue Aug 01, 2006 7:03 am    Post subject: Reply with quote

http://forums.qj.net/showthread.php?p=868511#post868511

I know this is resolved, but go here and scroll down to filebrowser example. It's pretty straight forward, and should help you out.
Back to top
View user's profile Send private message
sturatt



Joined: 13 Jul 2006
Posts: 46

PostPosted: Tue Aug 01, 2006 8:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Wed Aug 02, 2006 12:13 am    Post subject: Reply with quote

How thick does it make you feel?
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Wed Aug 02, 2006 12:54 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
danzel



Joined: 04 Nov 2005
Posts: 182

PostPosted: Tue Aug 08, 2006 9:35 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group