Get mod settings folder path (cross-platform)?

Started by Napoleonite, March 09, 2020, 04:51:37 PM

Previous topic - Next topic

Napoleonite

How do I retrieve the Config folder path (the one with the mod settings)? Every time a mod gets a serious update the settings can cause problems. I need a way to delete/clear this file and be able to display its contents.

On Windows it's this:
C:\Users\<username>\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\Config
but on Mac and Linux it's different. Is there a c# command to retrieve the path or if not, what are all possible paths?

LWM

Linux:  ~/.config/unity3d/Ludeon Studios/RimWorld by Ludeon Studios/Config

Napoleonite

#2
I think I also found the MacOSX version so:

        public static string GetModSettingsFolderPath()
        {
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
               return (@"C:\Users\" + Environment.UserName + @"\AppData\LocalLow\Ludeon Studios\RimWorld by Ludeon Studios\Config");
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                return "~/Library/Application Support/RimWorld/Config";
            }
            else // Linux
            {
                return "~/.config/unity3d/Ludeon Studios/RimWorld by Ludeon Studios/Config";
            }
        }


but it's not a 100% reliable (Mac OSX = technically also Unix?) sometimes I believe. I wonder how Rimworld retrieves the path. I can't test this without virtual machine nonsense.

LWM

GenFilePaths.ConfigFolderPath?

Be aware that mod settings for a steam-version of a mod ...don't play well.  I'm still not sure why.