mirror of
https://github.com/pspdev/pspsdk.git
synced 2025-10-04 09:08:30 +00:00
use psp specific functions
This commit is contained in:
@@ -1194,28 +1194,23 @@ char *realpath(const char *path, char *resolved_path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check if file or directory exist */
|
/* check if file or directory exist */
|
||||||
struct stat st;
|
SceIoStat psp_stat;
|
||||||
if (stat(path, &st) == 0) {
|
if (sceIoGetstat(path, &psp_stat) >= 0) {
|
||||||
if (S_ISREG(st.st_mode)) {
|
if (FIO_S_ISREG(psp_stat.st_mode)) {
|
||||||
SceUID uid = sceIoOpen(path, PSP_O_RDONLY, 0644);
|
SceUID uid = sceIoOpen(path, PSP_O_RDONLY, 0777);
|
||||||
if(uid < 0) {
|
if(uid < 0) {
|
||||||
errno = ENOENT;
|
errno = ENOENT;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sceIoClose(uid);
|
sceIoClose(uid);
|
||||||
} else if (S_ISDIR(st.st_mode)) {
|
} else if (FIO_S_ISDIR(psp_stat.st_mode)) {
|
||||||
SceUID uid = sceIoDopen(path);
|
SceUID uid = sceIoDopen(path);
|
||||||
if(uid < 0) {
|
if(uid < 0) {
|
||||||
errno = ENOTDIR;
|
errno = ENOTDIR;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
sceIoDclose(uid);
|
sceIoDclose(uid);
|
||||||
} else {
|
|
||||||
errno = ENOENT;
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if resolved_path arg is NULL, use malloc instead
|
// if resolved_path arg is NULL, use malloc instead
|
||||||
|
Reference in New Issue
Block a user