Skip to content

Commit

Permalink
make settings on linux+mac work again
Browse files Browse the repository at this point in the history
  • Loading branch information
Miepee committed Jan 7, 2022
1 parent c9c5d31 commit f655137
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions AM2RLauncher/AM2RLauncher/CrossPlatformOperations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ public class CrossPlatformOperations
/// </summary>
public static readonly string LINUXXDGCONFIG = Environment.GetEnvironmentVariable("XDG_CONFIG_HOME");

// Config for linux systems will be saved in XDG_CONFIG_HOME/AM2RLauncher (or if empty, ~/.config)
// Config for mac systems will be saved in ~/Library/Preferences/AM2RLauncher
/// <summary>
/// Path to the Config file folder on *nix based systems. <br/>
/// Linux: Will point to XDG_CONFIG_HOME/AM2RLauncher <br/>
Expand All @@ -51,6 +49,11 @@ public class CrossPlatformOperations
: LINUXXDGCONFIG) + "/AM2RLauncher")
: NIXHOME + "/Library/Preferences/AM2RLauncher";

/// <summary>
/// Config file path for *nix based systems. Will be <see cref="NIXLAUNCHERCONFIGPATH"/> + "/config.xml".
/// </summary>
public static readonly string NIXLAUNCHERCONFIGFILEPATH = NIXLAUNCHERCONFIGPATH + "/config.xml";

/// <summary>
/// Current Path where the Launcher is located. For more info, check <see cref="GenerateCurrentPath"/>.
/// </summary>
Expand Down Expand Up @@ -112,7 +115,7 @@ public static string ReadFromConfig(string property)
else if (currentPlatform.IsGtk || currentPlatform.IsMac)
{
string launcherConfigPath = NIXLAUNCHERCONFIGPATH;
string launcherConfigFilePath = launcherConfigPath + "/.config.xml";
string launcherConfigFilePath = launcherConfigPath + "/config.xml";
XML.LauncherConfigXML launcherConfig = new XML.LauncherConfigXML();

// If folder doesn't exist, create it and the config file
Expand Down Expand Up @@ -160,7 +163,7 @@ public static void WriteToConfig(string property, object value)
else if (currentPlatform.IsGtk || currentPlatform.IsMac)
{
string launcherConfigPath = NIXLAUNCHERCONFIGPATH;
string launcherConfigFilePath = launcherConfigPath + "/config.xml";
string launcherConfigFilePath = NIXLAUNCHERCONFIGFILEPATH;
XML.LauncherConfigXML launcherConfig = new XML.LauncherConfigXML();

// If folder doesn't exist, create it and the config file
Expand Down Expand Up @@ -208,7 +211,7 @@ public static void CopyOldConfigToNewConfig()
else if (currentPlatform.IsGtk || currentPlatform.IsMac)
{
string launcherConfigPath = NIXLAUNCHERCONFIGPATH;
string launcherConfigFilePath = launcherConfigPath + "/config.xml";
string launcherConfigFilePath = NIXLAUNCHERCONFIGFILEPATH;
XML.LauncherConfigXML launcherConfig = new XML.LauncherConfigXML();

// For some reason deserializing and saving back again works, not exactly sure why, but I'll take it
Expand Down

0 comments on commit f655137

Please sign in to comment.