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 

PS2Client & Directory Listing

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



Joined: 22 Apr 2004
Posts: 230

PostPosted: Tue Aug 29, 2006 3:23 am    Post subject: PS2Client & Directory Listing Reply with quote

hi,

in ps2link.c I see :
Code:

  // Convert the mode.
  mode = (stats.st_mode & 0x07);
  if (S_ISDIR(stats.st_mode)) { mode |= 0x20; }
#ifndef _WIN32
  if (S_ISLNK(stats.st_mode)) { mode |= 0x08; }
#endif
  if (S_ISREG(stats.st_mode)) { mode |= 0x10; }



now, when i'm using dread from my software I get mode equals to 0x25 for a directory. Is it normal ? Since based on sys\stat.h, for a directory I should have the value 0x1000 (once masked) ?

Code:

// File mode flags
#define FIO_S_IFMT      0xF000      // Format mask
#define FIO_S_IFLNK      0x4000      // Symbolic link
#define FIO_S_IFREG      0x2000      // Regular file
#define FIO_S_IFDIR      0x1000      // Directory

#define FIO_S_ISDIR(m)   (((m) & FIO_S_IFMT) == FIO_S_IFDIR)


So today I cannot use the "standard" following condition to test for a directory
Code:
S_ISDIR(dircontent.stat.mode)

but this
Code:
(dircontent.stat.mode==0x25)


Is there something i'm missing or the ps2link.c code should be instead :
Code:

  // Convert the mode.
  mode = (stats.st_mode & 0x07);
  if (S_ISDIR(stats.st_mode)) { mode |= 0x1000; }
#ifndef _WIN32
  if (S_ISLNK(stats.st_mode)) { mode |= 0x4000; }
#endif
  if (S_ISREG(stats.st_mode)) { mode |= 0x2000; }


thank you.
evilo

[EDIT]
1st, wrong place anyway, should be under "PS2 Software development",sorry...

then I just only saw that...

Code:


/* The following defines are only supported by ioman.  */

// File mode flags (for mode in io_stat_t)
#define FIO_SO_IFMT      0x0038      // Format mask
#define FIO_SO_IFLNK      0x0008      // Symbolic link
#define FIO_SO_IFREG      0x0010      // Regular file
#define FIO_SO_IFDIR      0x0020      // Directory

#define FIO_SO_IROTH      0x0004      // read
#define FIO_SO_IWOTH      0x0002      // write
#define FIO_SO_IXOTH      0x0001      // execute

// File mode checking macros
#define FIO_SO_ISLNK(m)   (((m) & FIO_SO_IFMT) == FIO_SO_IFLNK)
#define FIO_SO_ISREG(m)   (((m) & FIO_SO_IFMT) == FIO_SO_IFREG)
#define FIO_SO_ISDIR(m)   (((m) & FIO_SO_IFMT) == FIO_SO_IFDIR)


so ioman has it's own specific values, and FIO_SO_ISDIR(dircontent.stat.mode) is working like a charm :)

sorry ...
_________________
http://psxdev.info/evilo/
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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