(PS4/ORBIS) Move path_is_directory code parts to VFS layer - hope I did

it right
This commit is contained in:
twinaphex 2019-05-22 02:32:22 +02:00
parent f117d763d6
commit 32f9b9ab9a
2 changed files with 7 additions and 20 deletions

View File

@ -78,11 +78,6 @@
#include <unistd.h>
#endif
#if defined(ORBIS)
#include <orbisFile.h>
#include <sys/fcntl.h>
#include <sys/dirent.h>
#endif
#if defined(PSP)
#include <pspkernel.h>
#endif
@ -156,19 +151,7 @@ int path_stat(const char *path)
*/
bool path_is_directory(const char *path)
{
#ifdef ORBIS
/* TODO: This should be moved to the VFS module */
int dfd;
if (!path)
return false;
dfd = orbisDopen(path);
if (dfd < 0)
return false;
orbisDclose(dfd);
return true;
#else
return (path_stat_internal(path, NULL) & RETRO_VFS_STAT_IS_DIRECTORY) != 0;
#endif
}
bool path_is_character_special(const char *path)

View File

@ -62,6 +62,7 @@
# include <unistd.h>
# if defined(ORBIS)
# include <sys/fcntl.h>
# include <sys/dirent.h>
# include <orbisFile.h>
# endif
#endif
@ -788,9 +789,6 @@ const char *retro_vfs_file_get_path_impl(libretro_vfs_implementation_file *strea
int retro_vfs_stat_impl(const char *path, int32_t *size)
{
bool is_dir, is_character_special;
#if defined(ORBIS)
return 0; /* for now */
#endif
#if defined(VITA) || defined(PSP)
SceIoStat buf;
int stat_ret;
@ -803,6 +801,8 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
free(tmp);
if (stat_ret < 0)
return 0;
#elif defined(ORBIS)
int dir_ret;
#elif defined(PS2)
iox_stat_t buf;
char *tmp = strdup(path);
@ -864,6 +864,10 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
#if defined(VITA) || defined(PSP)
is_dir = FIO_S_ISDIR(buf.st_mode);
#elif defined(ORBIS)
dir_ret = orbisDopen(path);
is_dir = dir_ret > 0;
orbisDclose(dfd);
#elif defined(PS2)
if (!buf.mode)
{