mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
put the portable data path creation into the static constructor of DataLocation.cs
This commit is contained in:
parent
d0e092942b
commit
c3c21225e6
2 changed files with 22 additions and 12 deletions
|
|
@ -74,16 +74,6 @@ namespace Flow.Launcher.Core.Configuration
|
|||
///</summary>
|
||||
public void PreStartCleanUpAfterPortabilityUpdate()
|
||||
{
|
||||
// check whether the package locate in %LocalAppData%
|
||||
// if not create the portable data folder
|
||||
// Don't create the folder if the version is 1.0.0 (Dev) to allow potential debugging with data in the project folder
|
||||
// It is still possible to create the UserData folder for dev version manually but we want to keep the current behavior
|
||||
if (!Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData).PathContains(Constant.ProgramDirectory)
|
||||
&& Constant.Version != "1.0.0")
|
||||
{
|
||||
Directory.CreateDirectory(DataLocation.PortableDataPath);
|
||||
}
|
||||
|
||||
// Specify here so this method does not rely on other environment variables to initialise
|
||||
var portableDataDir = DataLocation.PortableDataPath;
|
||||
var roamingDataDir = DataLocation.RoamingDataPath;
|
||||
|
|
|
|||
|
|
@ -1,14 +1,32 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
|
||||
namespace Flow.Launcher.Infrastructure.UserSettings
|
||||
{
|
||||
public static class DataLocation
|
||||
{
|
||||
static DataLocation()
|
||||
{
|
||||
// check whether the package locate in %LocalAppData%
|
||||
// if not create the portable data folder
|
||||
// Don't create the folder if the version is 1.0.0 (Dev) to allow potential debugging with data in the project folder
|
||||
// It is still possible to create the UserData folder for dev version manually but we want to keep the current behavior
|
||||
if (!Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
|
||||
.PathContains(Constant.ProgramDirectory)
|
||||
&& Constant.Version != "1.0.0")
|
||||
{
|
||||
Directory.CreateDirectory(PortableDataPath);
|
||||
}
|
||||
}
|
||||
|
||||
public const string PortableFolderName = "UserData";
|
||||
public const string DeletionIndicatorFile = ".dead";
|
||||
public static string PortableDataPath = Path.Combine(Constant.ProgramDirectory, PortableFolderName);
|
||||
public static string RoamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlowLauncher");
|
||||
|
||||
public static string RoamingDataPath =
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "FlowLauncher");
|
||||
|
||||
public static string DataDirectory()
|
||||
{
|
||||
if (PortableDataLocationInUse())
|
||||
|
|
@ -26,7 +44,9 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
}
|
||||
|
||||
public static readonly string PluginsDirectory = Path.Combine(DataDirectory(), Constant.Plugins);
|
||||
public static readonly string PluginSettingsDirectory = Path.Combine(DataDirectory(), "Settings", Constant.Plugins);
|
||||
|
||||
public static readonly string PluginSettingsDirectory =
|
||||
Path.Combine(DataDirectory(), "Settings", Constant.Plugins);
|
||||
|
||||
public const string PythonEnvironmentName = "Python";
|
||||
public const string NodeEnvironmentName = "Node.js";
|
||||
|
|
|
|||
Loading…
Reference in a new issue