2022-11-27 21:44:42 +00:00
|
|
|
|
using System;
|
2020-04-01 11:20:33 +00:00
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
2020-04-21 09:12:17 +00:00
|
|
|
|
namespace Flow.Launcher.Infrastructure.UserSettings
|
2020-04-01 11:20:33 +00:00
|
|
|
|
{
|
|
|
|
|
|
public static class DataLocation
|
|
|
|
|
|
{
|
|
|
|
|
|
public const string PortableFolderName = "UserData";
|
|
|
|
|
|
public const string DeletionIndicatorFile = ".dead";
|
2025-09-21 08:21:38 +00:00
|
|
|
|
public static readonly string PortableDataPath = Path.Combine(Constant.ProgramDirectory, PortableFolderName);
|
|
|
|
|
|
public static readonly string RoamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlowLauncher");
|
2020-04-01 11:20:33 +00:00
|
|
|
|
public static string DataDirectory()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (PortableDataLocationInUse())
|
|
|
|
|
|
return PortableDataPath;
|
|
|
|
|
|
|
|
|
|
|
|
return RoamingDataPath;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool PortableDataLocationInUse()
|
|
|
|
|
|
{
|
2025-09-21 08:17:41 +00:00
|
|
|
|
if (Directory.Exists(PortableDataPath) &&
|
2025-09-21 08:21:38 +00:00
|
|
|
|
!File.Exists(Path.Combine(PortableDataPath, DeletionIndicatorFile)))
|
2020-04-01 11:20:33 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-09-21 08:45:25 +00:00
|
|
|
|
public static string VersionLogDirectory => Path.Combine(LogDirectory, Constant.Version);
|
|
|
|
|
|
public static string LogDirectory => Path.Combine(DataDirectory(), Constant.Logs);
|
2025-02-24 05:17:02 +00:00
|
|
|
|
|
2025-09-21 08:21:38 +00:00
|
|
|
|
public static readonly string CacheDirectory = Path.Combine(DataDirectory(), Constant.Cache);
|
|
|
|
|
|
public static readonly string SettingsDirectory = Path.Combine(DataDirectory(), Constant.Settings);
|
|
|
|
|
|
public static readonly string PluginsDirectory = Path.Combine(DataDirectory(), Constant.Plugins);
|
|
|
|
|
|
public static readonly string ThemesDirectory = Path.Combine(DataDirectory(), Constant.Themes);
|
2025-02-23 13:06:21 +00:00
|
|
|
|
|
2025-09-21 08:21:38 +00:00
|
|
|
|
public static readonly string PluginSettingsDirectory = Path.Combine(SettingsDirectory, Constant.Plugins);
|
|
|
|
|
|
public static readonly string PluginCacheDirectory = Path.Combine(DataDirectory(), Constant.Cache, Constant.Plugins);
|
2022-11-27 21:44:42 +00:00
|
|
|
|
|
2022-12-01 03:40:24 +00:00
|
|
|
|
public const string PythonEnvironmentName = "Python";
|
|
|
|
|
|
public const string NodeEnvironmentName = "Node.js";
|
|
|
|
|
|
public const string PluginEnvironments = "Environments";
|
2025-09-21 08:19:13 +00:00
|
|
|
|
public const string PluginDeleteFile = "NeedDelete.txt";
|
2025-09-21 08:21:38 +00:00
|
|
|
|
public static readonly string PluginEnvironmentsPath = Path.Combine(DataDirectory(), PluginEnvironments);
|
2020-04-01 11:20:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|