I'm using it by exporting from User prx to Vsh pbp,
it works for directory with no more than 2 subdirectories, otherwise it crash...
I can't undestrand why, probably something stupid, but maybe not....
I've thing that it could be a stack overflow but I've tryed to increase the calling thread stack and it still doesn't works...
Code: Select all
SceUInt64 XioDirSize(char* Dir)
{
return XioDirSizeFunct(Dir, 0);
}
SceUInt64 XioDirSizeFunct(char* Dir, SceUInt64 Size)
{
int dl = sceIoDopen(Dir);
if(dl < 0)
return 0;
SceIoDirent sid;
char Fullname[256];
memset(&sid, 0, sizeof (SceIoDirent));
while(sceIoDread(dl, &sid) > 0)
{
if((strcmp(sid.d_name, ".") == 0) || (strcmp(sid.d_name, "..") == 0))
continue;
sprintf(Fullname, "%s/%s", Dir, sid.d_name);
if(FIO_S_ISDIR(sid.d_stat.st_mode))
{
XioDirSizeFunct(Fullname, Size);
}
else
{
Size += sid.d_stat.st_size;
memset(&sid, 0, sizeof (SceIoDirent));
}
}
sceIoDclose(dl);
return Size;
}