mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 03:32:46 +00:00
Fix directory creation on GEKKO platforms when path contains a trailing slash
This commit is contained in:
parent
1496fda9bf
commit
3c06a907ca
@ -197,20 +197,6 @@ bool path_mkdir(const char *dir)
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(GEKKO)
|
||||
{
|
||||
size_t len = strlen(basedir);
|
||||
|
||||
/* path_parent_dir() keeps the trailing slash.
|
||||
* On Wii, mkdir() fails if the path has a
|
||||
* trailing slash...
|
||||
* We must therefore remove it. */
|
||||
if (len > 0)
|
||||
if (basedir[len - 1] == '/')
|
||||
basedir[len - 1] = '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
if (path_is_directory(basedir))
|
||||
norecurse = true;
|
||||
else
|
||||
|
@ -1024,6 +1024,28 @@ int retro_vfs_mkdir_impl(const char *dir)
|
||||
int ret = orbisMkdir(dir, 0755);
|
||||
#elif defined(__QNX__)
|
||||
int ret = mkdir(dir, 0777);
|
||||
#elif defined(GEKKO)
|
||||
/* On GEKKO platforms, mkdir() fails if
|
||||
* the path has a trailing slash. We must
|
||||
* therefore remove it. */
|
||||
int ret = -1;
|
||||
if (!string_is_empty(dir))
|
||||
{
|
||||
char *dir_buf = strdup(dir);
|
||||
|
||||
if (dir_buf)
|
||||
{
|
||||
size_t len = strlen(dir_buf);
|
||||
|
||||
if (len > 0)
|
||||
if (dir_buf[len - 1] == '/')
|
||||
dir_buf[len - 1] = '\0';
|
||||
|
||||
ret = mkdir(dir_buf, 0750);
|
||||
|
||||
free(dir_buf);
|
||||
}
|
||||
}
|
||||
#else
|
||||
int ret = mkdir(dir, 0750);
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user