libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.24k stars 1.83k forks source link

RetroArch keeps creating /storage/emulated/0/RetroArch/ folder on start on Android #9740

Closed thekiefs closed 2 years ago

thekiefs commented 4 years ago

Description

RetroArch keeps creating the /storage/emulated/0/RetroArch/ and associated subfolders (like cheats, screenshots, configs, etc) despite changing the default directory structure to a different location, even after I delete said folder

Expected behavior

I expect RetroArch to use the custom folders I set

Actual behavior

RetroArch re-creates the default folders

Steps to reproduce the bug

  1. In RetroArch, change Settings > Directory > Change all locations of settings to a custom location
  2. Delete the /storage/emulated/0/RetroArch/ folder and subfolders
  3. Close RetroAch 4 Open RetroArch
  4. See that /storage/emulated/0/RetroArch/ and all subfolders are recreated

Bisect Results

[Try to bisect and tell us when this started happening]

Version/Commit

You can find this information under Information/System Information

Environment information

andres-asm commented 4 years ago

That is performed before loading the config and there isn't much that can be done. The file placement situation is already difficult enough as is to be adding any more weird rules.

andres-asm commented 4 years ago

On windows we have this:

void dir_check_defaults(void)
{
   unsigned i;
   /* early return for people with a custom folder setup
      so it doesn't create unnecessary directories
    */
#if defined(ORBIS) || defined(ANDROID)
   if (path_is_valid("host0:app/custom.ini"))
#else
   if (path_is_valid("custom.ini"))
#endif
      return;

   for (i = 0; i < DEFAULT_DIR_LAST; i++)
   {
      char       *new_path = NULL;
      const char *dir_path = g_defaults.dirs[i];

      if (string_is_empty(dir_path))
         continue;

      new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char));

      if (!new_path)
         continue;

      new_path[0] = '\0';
      fill_pathname_expand_special(new_path,
            dir_path,
            PATH_MAX_LENGTH * sizeof(char));

      if (!path_is_directory(new_path))
         path_mkdir(new_path);

      free(new_path);
   }
}

Basically checks if there is a custom.ini in the retroarch dir. If such a file exists it doesn't re-create the internal dirs.

I see there is an android implementation but it's wrong. Also were would custom.ini reside? Actually for my own personal builds I have RetroArch set to store the global config in the RetroArch dir instead of /sdcard/Android/data/com.retroarch/files.

andres-asm commented 4 years ago

Anyway imho this should be a wont't fix. plenty of applicatioons create folders in sdcard.

thekiefs commented 4 years ago

Ok, but if there is an android implementation why not fix it so it is used correctly?

And I don't know of many applications that create folders in sdcard when the user has purposefully pointed the application to write to another directory / external card.

abouvier commented 2 years ago

Duplicate of https://github.com/libretro/RetroArch/issues/4610, https://github.com/libretro/RetroArch/issues/12054, https://github.com/libretro/RetroArch/issues/11742.

cesarpx commented 1 year ago

The same problem happens on Mac still in 2023. I defined a custom directory for Retroarch-related saves and updated the corresponding configuration file, but the application keeps creating empty folders in my own personal documents folder.

I don't understand why somebody mentioned this should be a won't fix since it looks this was a previous lazy fix to avoid other problems. But honestly, there should be a way to prevent this from happening. It's also confusing having two RetroArch state folders, the one that I'm currently using, and the other one that gets created automatically.