mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Update all applicable files to use the new data location class
This commit is contained in:
parent
6134550827
commit
d0976a99c9
10 changed files with 24 additions and 18 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using NLog;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using System;
|
||||
|
|
@ -7,6 +7,7 @@ using System.IO;
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
using Wox.Infrastructure;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox.Plugin.Program.Logger
|
||||
{
|
||||
|
|
@ -21,7 +22,7 @@ namespace Wox.Plugin.Program.Logger
|
|||
|
||||
static ProgramLogger()
|
||||
{
|
||||
var path = Path.Combine(Constant.DataDirectory, DirectoryName, Constant.Version);
|
||||
var path = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Version);
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ namespace Wox.Core.Configuration
|
|||
.CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree)) {; }
|
||||
|
||||
var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
|
||||
.CreateSubKey(uninstallRegSubKey + "\\" + applicationName, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
.CreateSubKey(uninstallRegSubKey + "\\" + Constant.Wox, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
key.SetValue("DisplayIcon", Constant.ApplicationDirectory + "\\app.ico", RegistryValueKind.String);
|
||||
|
||||
portabilityUpdater.CreateUninstallerRegistryEntry();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ namespace Wox.Core.Plugin
|
|||
return;
|
||||
}
|
||||
|
||||
string pluginFolerPath = Infrastructure.Constant.PluginsDirectory;
|
||||
string pluginFolerPath = Infrastructure.UserSettings.DataLocation.PluginsDirectory;
|
||||
|
||||
string newPluginName = plugin.Name
|
||||
.Replace("/", "_")
|
||||
|
|
|
|||
|
|
@ -32,20 +32,20 @@ namespace Wox.Core.Plugin
|
|||
// todo happlebao, this should not be public, the indicator function should be embeded
|
||||
public static PluginsSettings Settings;
|
||||
private static List<PluginMetadata> _metadatas;
|
||||
private static readonly string[] Directories = { Constant.PreinstalledDirectory, Constant.PluginsDirectory };
|
||||
private static readonly string[] Directories = { Constant.PreinstalledDirectory, DataLocation.PluginsDirectory };
|
||||
|
||||
private static void ValidateUserDirectory()
|
||||
{
|
||||
if (!Directory.Exists(Constant.PluginsDirectory))
|
||||
if (!Directory.Exists(DataLocation.PluginsDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(Constant.PluginsDirectory);
|
||||
Directory.CreateDirectory(DataLocation.PluginsDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
private static void DeletePythonBinding()
|
||||
{
|
||||
const string binding = "wox.py";
|
||||
var directory = Constant.PluginsDirectory;
|
||||
var directory = DataLocation.PluginsDirectory;
|
||||
foreach (var subDirectory in Directory.GetDirectories(directory))
|
||||
{
|
||||
var path = Path.Combine(subDirectory, binding);
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ namespace Wox.Core.Resource
|
|||
private const string Folder = "Themes";
|
||||
private const string Extension = ".xaml";
|
||||
private string DirectoryPath => Path.Combine(Constant.ProgramDirectory, Folder);
|
||||
private string UserDirectoryPath => Path.Combine(Constant.DataDirectory, Folder);
|
||||
private string UserDirectoryPath => Path.Combine(DataLocation.DataDirectory(), Folder);
|
||||
|
||||
public Theme()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ using Wox.Infrastructure;
|
|||
using Wox.Infrastructure.Http;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using System.IO;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox.Core
|
||||
{
|
||||
|
|
@ -80,13 +81,13 @@ namespace Wox.Core
|
|||
|
||||
await updateManager.ApplyReleases(newUpdateInfo);
|
||||
|
||||
if (Constant.IsPortableMode)
|
||||
if (DataLocation.PortableDataLocationInUse)
|
||||
{
|
||||
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{Constant.PortableFolderName}";
|
||||
FilesFolders.Copy(Constant.PortableDataPath, targetDestination);
|
||||
if (!FilesFolders.VerifyBothFolderFilesEqual(Constant.PortableDataPath, targetDestination))
|
||||
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}";
|
||||
FilesFolders.Copy(DataLocation.PortableDataPath, targetDestination);
|
||||
if (!FilesFolders.VerifyBothFolderFilesEqual(DataLocation.PortableDataPath, targetDestination))
|
||||
MessageBox.Show(string.Format("Wox was not able to move your user profile data to the new update version. Please manually" +
|
||||
"move your profile data folder from {0} to {1}", Constant.PortableDataPath, targetDestination));
|
||||
"move your profile data folder from {0} to {1}", DataLocation.PortableDataPath, targetDestination));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.Runtime.CompilerServices;
|
|||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox.Infrastructure.Logger
|
||||
{
|
||||
|
|
@ -15,7 +16,7 @@ namespace Wox.Infrastructure.Logger
|
|||
|
||||
static Log()
|
||||
{
|
||||
CurrentLogDirectory = Path.Combine(Constant.DataDirectory, DirectoryName, Constant.Version);
|
||||
CurrentLogDirectory = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Version);
|
||||
if (!Directory.Exists(CurrentLogDirectory))
|
||||
{
|
||||
Directory.CreateDirectory(CurrentLogDirectory);
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Runtime.Serialization;
|
|||
using System.Runtime.Serialization.Formatters;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using Wox.Infrastructure.Logger;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
|
|
@ -17,7 +18,7 @@ namespace Wox.Infrastructure.Storage
|
|||
public BinaryStorage(string filename)
|
||||
{
|
||||
const string directoryName = "Cache";
|
||||
var directoryPath = Path.Combine(Constant.DataDirectory, directoryName);
|
||||
var directoryPath = Path.Combine(DataLocation.DataDirectory(), directoryName);
|
||||
Helper.ValidateDirectory(directoryPath);
|
||||
|
||||
const string fileSuffix = ".cache";
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.IO;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
|
|
@ -9,7 +10,7 @@ namespace Wox.Infrastructure.Storage
|
|||
// C# releated, add python releated below
|
||||
var dataType = typeof(T);
|
||||
var assemblyName = typeof(T).Assembly.GetName().Name;
|
||||
DirectoryPath = Path.Combine(Constant.DataDirectory, DirectoryName, Constant.Plugins, assemblyName);
|
||||
DirectoryPath = Path.Combine(DataLocation.DataDirectory(), DirectoryName, Constant.Plugins, assemblyName);
|
||||
Helper.ValidateDirectory(DirectoryPath);
|
||||
|
||||
FilePath = Path.Combine(DirectoryPath, $"{dataType.Name}{FileSuffix}");
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Wox.Infrastructure.UserSettings;
|
||||
|
||||
namespace Wox.Infrastructure.Storage
|
||||
{
|
||||
|
|
@ -11,7 +12,7 @@ namespace Wox.Infrastructure.Storage
|
|||
{
|
||||
public WoxJsonStorage()
|
||||
{
|
||||
var directoryPath = Path.Combine(Constant.DataDirectory, DirectoryName);
|
||||
var directoryPath = Path.Combine(DataLocation.DataDirectory(), DirectoryName);
|
||||
Helper.ValidateDirectory(directoryPath);
|
||||
|
||||
var filename = typeof(T).Name;
|
||||
|
|
|
|||
Loading…
Reference in a new issue