[fix?:] windows paths (ai-based since windows is boring)
This commit is contained in:
+13
-6
@@ -24,8 +24,7 @@ public class Settings
|
||||
public static void Save()
|
||||
{
|
||||
if (!Directory.Exists(Global._instance.config_path))
|
||||
Directory.CreateDirectory(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"logofclient"));
|
||||
Directory.CreateDirectory(Global._instance.config_path);
|
||||
// if (!string.IsNullOrEmpty(Global._instance.config_path)) _instance.settingsPath = Global._instance.config_path;
|
||||
|
||||
var json = JsonConvert.SerializeObject(_instance);
|
||||
@@ -79,14 +78,14 @@ public class Global
|
||||
_instance = this;
|
||||
}
|
||||
|
||||
public string config_path { get; } = Path.Combine(
|
||||
public string config_path { get; set; } = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
"logofclient");
|
||||
|
||||
public void SetConfigPath(string path)
|
||||
{
|
||||
Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData));
|
||||
if (!string.IsNullOrWhiteSpace(path))
|
||||
config_path = PathUtilities.NormalizeFileSystemPath(path);
|
||||
}
|
||||
public string wiki_storage_path { get; set; } = Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||
@@ -121,7 +120,8 @@ public class Global
|
||||
var contents = File.ReadAllText(Path.Combine(
|
||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "logofclient",
|
||||
"global.config"));
|
||||
_instance = JsonConvert.DeserializeObject<Global>(contents);
|
||||
_instance = JsonConvert.DeserializeObject<Global>(contents) ?? new Global();
|
||||
_instance.NormalizePaths();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -130,6 +130,13 @@ public class Global
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
private void NormalizePaths()
|
||||
{
|
||||
config_path = PathUtilities.NormalizeFileSystemPath(config_path);
|
||||
wiki_storage_path = PathUtilities.NormalizeFileSystemPath(wiki_storage_path);
|
||||
font_path = PathUtilities.NormalizeFileSystemPath(font_path);
|
||||
}
|
||||
}
|
||||
|
||||
public class Customers
|
||||
|
||||
Reference in New Issue
Block a user