mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add disable portable mode programatically
This commit is contained in:
parent
61845dd0db
commit
2531f71402
3 changed files with 22 additions and 5 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using Microsoft.Win32;
|
||||
using Squirrel;
|
||||
using System;
|
||||
using Wox.Infrastructure;
|
||||
|
|
@ -16,12 +17,13 @@ namespace Wox.Core.Configuration
|
|||
|
||||
public Portable()
|
||||
{
|
||||
//NEED TO DYNAMICALLY GET WOX'S LOCATION OTHERWISE SHORTCUTS WONT WORK
|
||||
applicationName = Constant.Wox;
|
||||
exeName = applicationName + ".exe";
|
||||
rootAppDirectory = Constant.RootDirectory;
|
||||
portabilityUpdater = new UpdateManager(string.Empty, applicationName, rootAppDirectory);
|
||||
portabilityUpdater = new UpdateManager(string.Empty, applicationName, rootAppDirectory);
|
||||
|
||||
roamingDataPath = Constant.RoamingDataPath;
|
||||
roamingDataPath = Constant.RoamingDataPath;
|
||||
portableDataPath = Constant.PortableDataPath;
|
||||
}
|
||||
|
||||
|
|
@ -31,7 +33,7 @@ namespace Wox.Core.Configuration
|
|||
{
|
||||
MoveUserDataFolder(portableDataPath, roamingDataPath);
|
||||
CreateShortcuts();
|
||||
CreateUninstallerEntry();
|
||||
CreateUninstallerEntry(); //DOES NOT CREATE THE UNINSTALLER ICON!!!!!!
|
||||
|
||||
// always dispose UpdateManager???????????
|
||||
// CHANGE TO PRIVATE/INTERNAL METHODS
|
||||
|
|
@ -108,7 +110,17 @@ namespace Wox.Core.Configuration
|
|||
|
||||
public void CreateUninstallerEntry()
|
||||
{
|
||||
portabilityUpdater.CreateUninstallerRegistryEntry();
|
||||
var uninstallRegSubKey = @"Software\Microsoft\Windows\CurrentVersion\Uninstall";
|
||||
// NB: Sometimes the Uninstall key doesn't exist
|
||||
using (var parentKey =
|
||||
RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
|
||||
.CreateSubKey("Uninstall", RegistryKeyPermissionCheck.ReadWriteSubTree)) {; }
|
||||
|
||||
var key = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
|
||||
.CreateSubKey(uninstallRegSubKey + "\\" + applicationName, RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||
key.SetValue("DisplayIcon", Constant.ApplicationDirectory + "\\app.ico", RegistryValueKind.String);
|
||||
|
||||
portabilityUpdater.CreateUninstallerRegistryEntry().Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Wox.Infrastructure
|
|||
private static readonly Assembly Assembly = Assembly.GetExecutingAssembly();
|
||||
public static readonly string ProgramDirectory = Directory.GetParent(Assembly.Location.NonNull()).ToString();
|
||||
public static readonly string ExecutablePath = Path.Combine(ProgramDirectory, Wox + ".exe");
|
||||
private static readonly string ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
|
||||
public static readonly string ApplicationDirectory = Directory.GetParent(ProgramDirectory).ToString();
|
||||
public static readonly string RootDirectory = Directory.GetParent(ApplicationDirectory).ToString();
|
||||
|
||||
public const string PortableFolderName = "UserData";
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ namespace Wox.ViewModel
|
|||
_portable.EnablePortableMode();
|
||||
}
|
||||
|
||||
public void DisablePortableMode()
|
||||
{
|
||||
_portable.DisablePortableMode();
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
_storage.Save();
|
||||
|
|
|
|||
Loading…
Reference in a new issue