Fix issues when home directory does not exist.

pull/52/head
Miepee 4 years ago
parent c5b011627b
commit 3583ef65c8

@ -144,9 +144,7 @@ public partial class MainForm : Form
log.Info("Checking whether to transfer Flatpak saves..."); log.Info("Checking whether to transfer Flatpak saves...");
string oldHomePath = CrossPlatformOperations.Home; string oldHomePath = CrossPlatformOperations.Home;
log.Info("Old home path is " + oldHomePath); log.Info("Old home path is " + oldHomePath);
var option = Environment.SpecialFolderOption.DoNotVerify; Environment.SetEnvironmentVariable("HOME", $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, Environment.SpecialFolderOption.DoNotVerify)}/AM2RProfileSaves");
log.Info("option is " + option);
Environment.SetEnvironmentVariable("HOME", $"{Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData, option)}/AM2RProfileSaves");
string newHomePath = CrossPlatformOperations.Home; string newHomePath = CrossPlatformOperations.Home;
log.Info("New home path is " + newHomePath); log.Info("New home path is " + newHomePath);

@ -25,7 +25,7 @@ public static class CrossPlatformOperations
/// <summary> /// <summary>
/// Path to the Home Folder. /// Path to the Home Folder.
/// </summary> /// </summary>
public static string Home => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.Create); public static string Home => Environment.GetFolderPath(Environment.SpecialFolder.UserProfile, Environment.SpecialFolderOption.DoNotVerify);
/// <summary> /// <summary>
/// Config file path for *nix based systems. <br/> /// Config file path for *nix based systems. <br/>

Loading…
Cancel
Save