mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
separate get data location code from constant file
This commit is contained in:
parent
be8da8035e
commit
4fc30166bf
2 changed files with 32 additions and 21 deletions
31
Wox.Infrastructure/UserSettings/DataLocation.cs
Normal file
31
Wox.Infrastructure/UserSettings/DataLocation.cs
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wox.Infrastructure.UserSettings
|
||||
{
|
||||
public static class DataLocation
|
||||
{
|
||||
public static bool PortableDataLocationInUse;
|
||||
public const string PortableFolderName = "UserData";
|
||||
public static string PortableDataPath = Path.Combine(Constant.ProgramDirectory, PortableFolderName);
|
||||
public static string RoamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Constant.Wox);
|
||||
public static string DataDirectory()
|
||||
{
|
||||
if (Directory.Exists(PortableDataPath))
|
||||
{
|
||||
PortableDataLocationInUse = true;
|
||||
return PortableDataPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RoamingDataPath;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly string PluginsDirectory = Path.Combine(DataDirectory(), Constant.Plugins);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
|
@ -15,26 +14,7 @@ namespace Wox.Infrastructure
|
|||
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
|
||||
public static readonly string ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
|
||||
public static readonly string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
|
||||
|
||||
public static bool IsPortableMode;
|
||||
public const string PortableFolderName = "UserData";
|
||||
public static string PortableDataPath = Path.Combine(ProgramDirectory, PortableFolderName);
|
||||
public static string RoamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Wox);
|
||||
public static string DetermineDataDirectory()
|
||||
{
|
||||
if (Directory.Exists(PortableDataPath))
|
||||
{
|
||||
IsPortableMode = true;
|
||||
return PortableDataPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RoamingDataPath;
|
||||
}
|
||||
}
|
||||
|
||||
public static readonly string DataDirectory = DetermineDataDirectory();
|
||||
public static readonly string PluginsDirectory = Path.Combine(DataDirectory, Plugins);
|
||||
|
||||
public static readonly string PreinstalledDirectory = Path.Combine(ProgramDirectory, Plugins);
|
||||
public const string Issue = "https://github.com/Wox-launcher/Wox/issues/new";
|
||||
public static readonly string Version = FileVersionInfo.GetVersionInfo(Assembly.Location.NonNull()).ProductVersion;
|
||||
|
|
|
|||
Loading…
Reference in a new issue