Excuse me for another post,
I've to get the info of a file ( if is a dir or a file) and if is possible other info,
( creation date, ... ), i've read the pspiofilemgr but there is no function like this! Can anyone help me...
Tanks in advance!
[SOLVED]Help with file info...
[SOLVED]Help with file info...
Last edited by ne0h on Fri Mar 28, 2008 6:21 am, edited 1 time in total.
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
That's some code I found and mixed together to see if a file is a file or a folder. I don't know why the "for" loop is there but that works. If you want to test if it's a file rather than a folder, replace "FIO_SO_IFDIR" with "FIO_SO_IFREG":
I have those filesystem related functions if you want:
Code: Select all
bool isFolder(string folder)
{
SceIoDirent dir;
int dfd, ok;
bool res=false;
dfd = sceIoDopen(folder.c_str());
if (dfd>=0)
{
for (;;)
{
memset(&dir, 0, sizeof dir);
ok = sceIoDread(dfd, &dir);
if (ok<=0)
break;
//extract info from dir
if(dir.d_stat.st_attr & FIO_SO_IFDIR)
{
res=true;
}
}
sceIoDclose(dfd);
}
return res;
}
Code: Select all
list<string> *directoryListFiles(string folder);
list<string> *directoryListFolders(string folder);
bool fileExists(string file);
bool directoryExists(string dir);
string getCurrentDirectory();
bool createDirectory(string dir);
-
- Posts: 376
- Joined: Wed May 10, 2006 11:31 pm
You'd be better doing something like this:
Code: Select all
int isFolder(const char *path)
{
SceIoStat stats;
sceIoGetstat(path, &stats);
if (stats.st_mode & FIO_S_IFDIR)
return 1;
return 0;
}