mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use constants & data location for code quality
This commit is contained in:
parent
f1b5e68cf2
commit
1aaba46b8f
5 changed files with 8 additions and 6 deletions
|
|
@ -21,7 +21,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
/// </remarks>
|
||||
public class BinaryStorage<T>
|
||||
{
|
||||
const string DirectoryName = "Cache";
|
||||
const string DirectoryName = Constant.Cache;
|
||||
|
||||
const string FileSuffix = ".cache";
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
protected T? Data;
|
||||
|
||||
// need a new directory name
|
||||
public const string DirectoryName = "Settings";
|
||||
public const string DirectoryName = Constant.Settings;
|
||||
public const string FileSuffix = ".json";
|
||||
|
||||
protected string FilePath { get; init; } = null!;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Flow.Launcher.Infrastructure.Storage
|
|||
// C# related, add python related below
|
||||
var dataType = typeof(T);
|
||||
AssemblyName = dataType.Assembly.GetName().Name;
|
||||
DirectoryPath = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Plugins, AssemblyName);
|
||||
DirectoryPath = Path.Combine(DataLocation.PluginSettingsDirectory, AssemblyName);
|
||||
Helper.ValidateDirectory(DirectoryPath);
|
||||
|
||||
FilePath = Path.Combine(DirectoryPath, $"{dataType.Name}{FileSuffix}");
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
return false;
|
||||
}
|
||||
|
||||
public static readonly string SettingsDirectorty = Path.Combine(DataDirectory(), Constant.Settings);
|
||||
public static readonly string PluginsDirectory = Path.Combine(DataDirectory(), Constant.Plugins);
|
||||
public static readonly string PluginSettingsDirectory = Path.Combine(DataDirectory(), Constant.Settings, Constant.Plugins);
|
||||
|
||||
public static readonly string PluginSettingsDirectory = Path.Combine(SettingsDirectorty, Constant.Plugins);
|
||||
public static readonly string PluginCacheDirectory = Path.Combine(DataDirectory(), Constant.Cache, Constant.Plugins);
|
||||
|
||||
public const string PythonEnvironmentName = "Python";
|
||||
|
|
|
|||
|
|
@ -77,13 +77,13 @@ public partial class SettingsPaneAboutViewModel : BaseModel
|
|||
[RelayCommand]
|
||||
private void OpenSettingsFolder()
|
||||
{
|
||||
PluginManager.API.OpenDirectory(Path.Combine(DataLocation.DataDirectory(), Constant.Settings));
|
||||
PluginManager.API.OpenDirectory(DataLocation.SettingsDirectorty);
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void OpenParentOfSettingsFolder(object parameter)
|
||||
{
|
||||
string settingsFolderPath = Path.Combine(DataLocation.DataDirectory(), Constant.Settings);
|
||||
string settingsFolderPath = Path.Combine(DataLocation.SettingsDirectorty);
|
||||
string parentFolderPath = Path.GetDirectoryName(settingsFolderPath);
|
||||
PluginManager.API.OpenDirectory(parentFolderPath);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue