mirror of
https://github.com/libretro/RetroArch
synced 2025-03-28 19:20:35 +00:00
Automatically rename asset directory
== DETAILS For users upgrading--particularly via the online updater--we should smoothly migrate them to the new name. If the "media" directory exists and the "assets" directory doesn't, then rename "media" to "assets". == TESTING none yet
This commit is contained in:
parent
4cd3934610
commit
bff8e8204d
@ -69,6 +69,28 @@
|
||||
static enum frontend_fork wiiu_fork_mode = FRONTEND_FORK_NONE;
|
||||
static const char *elf_path_cst = WIIU_SD_PATH "retroarch/retroarch.elf";
|
||||
|
||||
static bool exists(char *path) {
|
||||
struct stat stat_buf = {0};
|
||||
|
||||
if(!path)
|
||||
return false;
|
||||
|
||||
return (stat(path, &stat_buf) == 0);
|
||||
}
|
||||
|
||||
static void fix_asset_directory(void) {
|
||||
char src_path_buf[PATH_MAX_LENGTH] = {0};
|
||||
char dst_path_buf[PATH_MAX_LENGTH] = {0};
|
||||
|
||||
fill_pathname_join(src_path_buf, g_defaults.dirs[DEFAULT_DIR_PORT], "media", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
fill_pathname_join(dst_path_buf, g_defaults.dirs[DEFAULT_DIR_PORT], "assets", sizeof(g_defaults.dirs[DEFAULT_DIR_PORT]));
|
||||
|
||||
if(exists(dst_path_buf) || !exists(src_path_buf))
|
||||
return;
|
||||
|
||||
rename(src_path_buf, dst_path_buf);
|
||||
}
|
||||
|
||||
static void frontend_wiiu_get_environment_settings(int *argc, char *argv[],
|
||||
void *args, void *params_data)
|
||||
{
|
||||
@ -79,6 +101,7 @@ static void frontend_wiiu_get_environment_settings(int *argc, char *argv[],
|
||||
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"downloads", sizeof(g_defaults.dirs[DEFAULT_DIR_CORE_ASSETS]));
|
||||
fix_asset_directory();
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_ASSETS], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
"assets", sizeof(g_defaults.dirs[DEFAULT_DIR_ASSETS]));
|
||||
fill_pathname_join(g_defaults.dirs[DEFAULT_DIR_CORE], g_defaults.dirs[DEFAULT_DIR_PORT],
|
||||
|
Loading…
x
Reference in New Issue
Block a user