mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
After restart, clean up data folder locations so only one is used
This commit is contained in:
parent
7ac69f9bcd
commit
56b8b5f3d6
2 changed files with 36 additions and 0 deletions
|
|
@ -129,6 +129,40 @@ namespace Wox.Core.Configuration
|
|||
key.SetValue("DisplayIcon", Constant.ApplicationDirectory + "\\app.ico", RegistryValueKind.String);
|
||||
|
||||
portabilityUpdater.CreateUninstallerRegistryEntry().Wait();
|
||||
public void CleanUpFolderAfterPortabilityUpdate()
|
||||
{
|
||||
var portableDataPath = Path.Combine(Directory.GetParent(Assembly.GetExecutingAssembly().Location.NonNull()).ToString(), "UserData");
|
||||
var roamingDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Wox");
|
||||
|
||||
bool DataLocationPortableDeleteRequired = false;
|
||||
bool DataLocationRoamingDeleteRequired = false;
|
||||
|
||||
if ((roamingDataPath + "\\.dead").FileExits())
|
||||
DataLocationRoamingDeleteRequired = true;
|
||||
|
||||
if ((portableDataPath + "\\.dead").FileExits())
|
||||
DataLocationPortableDeleteRequired = true;
|
||||
|
||||
if (DataLocationRoamingDeleteRequired)
|
||||
{
|
||||
if(roamingDataPath.LocationExists())
|
||||
MessageBox.Show("Wox detected you restarted after enabling portable mode, " +
|
||||
"your roaming data profile will now be deleted");
|
||||
|
||||
FilesFolders.RemoveFolderIfExists(roamingDataPath);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(DataLocationPortableDeleteRequired)
|
||||
{
|
||||
MessageBox.Show("Wox detected you restarted after disabling portable mode, " +
|
||||
"your portable data profile will now be deleted");
|
||||
|
||||
FilesFolders.RemoveFolderIfExists(portableDataPath);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ namespace Wox
|
|||
{
|
||||
Stopwatch.Normal("|App.OnStartup|Startup cost", () =>
|
||||
{
|
||||
_portable.CleanUpFolderAfterPortabilityUpdate();
|
||||
|
||||
Log.Info("|App.OnStartup|Begin Wox startup ----------------------------------------------------");
|
||||
Log.Info($"|App.OnStartup|Runtime info:{ErrorReporting.RuntimeInfo()}");
|
||||
RegisterAppDomainExceptions();
|
||||
|
|
|
|||
Loading…
Reference in a new issue