mirror of
https://github.com/Stone-Red-Code/Markdowser.git
synced 2026-09-04 09:06:15 +02:00
Make paths cross-platform
This commit is contained in:
@@ -1,12 +1,39 @@
|
|||||||
using System;
|
using Syroot.Windows.IO;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace Markdowser.Utilities;
|
namespace Markdowser.Utilities;
|
||||||
|
|
||||||
internal static class Configuration
|
internal static class Configuration
|
||||||
{
|
{
|
||||||
public static string DownloadPath => Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
|
public static string DownloadPath
|
||||||
public static string ApplicationDataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), nameof(Markdowser));
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return KnownFolders.Downloads.Path;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Downloads");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string ApplicationDataPath
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "StoneRed", nameof(Markdowser));
|
||||||
|
}
|
||||||
|
|
||||||
|
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StoneRed", nameof(Markdowser));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static string SettingsFilePath => Path.Combine(ApplicationDataPath, "settings.json");
|
public static string SettingsFilePath => Path.Combine(ApplicationDataPath, "settings.json");
|
||||||
|
public static string LogFilePath => Path.Combine(ApplicationDataPath, $"{nameof(Markdowser)}.log");
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user