mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Change PortableDataLocationInUse property to method
Added const for deletion indicator
This commit is contained in:
parent
d0976a99c9
commit
ef1b52122e
4 changed files with 17 additions and 14 deletions
|
|
@ -133,7 +133,7 @@ namespace Wox.Core.Configuration
|
|||
|
||||
public void IndicateDeletion(string filePathTodelete)
|
||||
{
|
||||
using (StreamWriter sw = File.CreateText(filePathTodelete + "\\.dead")){}
|
||||
using (StreamWriter sw = File.CreateText(filePathTodelete + "\\" + DataLocation.DeletionIndicatorFile)){}
|
||||
}
|
||||
|
||||
public void CleanUpFolderAfterPortabilityUpdate()
|
||||
|
|
@ -144,10 +144,10 @@ namespace Wox.Core.Configuration
|
|||
bool DataLocationPortableDeleteRequired = false;
|
||||
bool DataLocationRoamingDeleteRequired = false;
|
||||
|
||||
if ((roamingDataPath + "\\.dead").FileExits())
|
||||
if ((roamingDataPath + "\\" + DataLocation.DeletionIndicatorFile).FileExits())
|
||||
DataLocationRoamingDeleteRequired = true;
|
||||
|
||||
if ((portableDataPath + "\\.dead").FileExits())
|
||||
if ((portableDataPath + "\\" + DataLocation.DeletionIndicatorFile).FileExits())
|
||||
DataLocationPortableDeleteRequired = true;
|
||||
|
||||
if (DataLocationRoamingDeleteRequired)
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Wox.Core
|
|||
|
||||
await updateManager.ApplyReleases(newUpdateInfo);
|
||||
|
||||
if (DataLocation.PortableDataLocationInUse)
|
||||
if (DataLocation.PortableDataLocationInUse())
|
||||
{
|
||||
var targetDestination = updateManager.RootAppDirectory + $"\\app-{newReleaseVersion.ToString()}\\{DataLocation.PortableFolderName}";
|
||||
FilesFolders.Copy(DataLocation.PortableDataPath, targetDestination);
|
||||
|
|
|
|||
|
|
@ -9,21 +9,24 @@ namespace Wox.Infrastructure.UserSettings
|
|||
{
|
||||
public static class DataLocation
|
||||
{
|
||||
public static bool PortableDataLocationInUse;
|
||||
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), Constant.Wox);
|
||||
public static string DataDirectory()
|
||||
{
|
||||
if (Directory.Exists(PortableDataPath))
|
||||
{
|
||||
PortableDataLocationInUse = true;
|
||||
if (PortableDataLocationInUse())
|
||||
return PortableDataPath;
|
||||
}
|
||||
else
|
||||
{
|
||||
return RoamingDataPath;
|
||||
}
|
||||
|
||||
return RoamingDataPath;
|
||||
}
|
||||
|
||||
public static bool PortableDataLocationInUse()
|
||||
{
|
||||
if (Directory.Exists(PortableDataPath) && !File.Exists(DeletionIndicatorFile))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static readonly string PluginsDirectory = Path.Combine(DataDirectory(), Constant.Plugins);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace Wox.Infrastructure.UserSettings
|
|||
public bool DontPromptUpdateMsg { get; set; }
|
||||
public bool EnableUpdateLog { get; set; }
|
||||
|
||||
public bool PortableMode { get; set; } = false;
|
||||
public bool PortableMode { get; set; } = DataLocation.PortableDataLocationInUse();
|
||||
|
||||
public bool StartWoxOnSystemStartup { get; set; } = true;
|
||||
public bool HideOnStartup { get; set; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue