Refactor internal data path finding to Utilities
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.IO;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
@@ -35,4 +36,17 @@ class Utilities
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetInternalDataPath()
|
||||||
|
{
|
||||||
|
var path = Path.Combine(
|
||||||
|
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
||||||
|
"MayShow"
|
||||||
|
);
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -41,14 +41,7 @@ class Settings : ChangeNotifier
|
|||||||
|
|
||||||
public static string GetSettingsPath()
|
public static string GetSettingsPath()
|
||||||
{
|
{
|
||||||
var path = Path.Combine(
|
var path = Utilities.GetInternalDataPath();
|
||||||
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
||||||
"MayShow"
|
|
||||||
);
|
|
||||||
if (!Directory.Exists(path))
|
|
||||||
{
|
|
||||||
Directory.CreateDirectory(path);
|
|
||||||
}
|
|
||||||
return Path.Combine(path, GetSettingsFileName());
|
return Path.Combine(path, GetSettingsFileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user