diff --git a/Wox.Core/Configuration/IPortable.cs b/Wox.Core/Configuration/IPortable.cs index 74e32fecd..95c1b345b 100644 --- a/Wox.Core/Configuration/IPortable.cs +++ b/Wox.Core/Configuration/IPortable.cs @@ -7,6 +7,8 @@ namespace Wox.Core.Configuration void DisablePortableMode(); void RemoveShortcuts(); void RemoveUninstallerEntry(); + void CreateShortcuts(); + void CreateUninstallerEntry(); bool IsPortableModeEnabled(); void MoveUserDataFolder(string fromLocation, string toLocation); void VerifyUserDataAfterMove(string fromLocation, string toLocation); diff --git a/Wox.Core/Configuration/Portable.cs b/Wox.Core/Configuration/Portable.cs index 5f5a60be6..422bbc2f8 100644 --- a/Wox.Core/Configuration/Portable.cs +++ b/Wox.Core/Configuration/Portable.cs @@ -27,7 +27,25 @@ namespace Wox.Core.Configuration public void DisablePortableMode() { - throw new NotImplementedException(); + try + { + MoveUserDataFolder(portableDataPath, roamingDataPath); + CreateShortcuts(); + CreateUninstallerEntry(); + + // always dispose UpdateManager??????????? + // CHANGE TO PRIVATE/INTERNAL METHODS + } + catch (Exception e) + { + //log and update error message to output above locations where shortcuts may not have been removed +#if DEBUG + throw; +#else + throw;// PRODUCTION LOGGING AND CONTINUE + +#endif + } } public void EnablePortableMode() @@ -37,6 +55,8 @@ namespace Wox.Core.Configuration MoveUserDataFolder(roamingDataPath, portableDataPath); RemoveShortcuts(); RemoveUninstallerEntry(); + + // always dispose UpdateManager??????????? } catch (Exception e) { @@ -78,5 +98,17 @@ namespace Wox.Core.Configuration { FilesFolders.VerifyBothFolderFilesEqual(fromLocation, toLocation); } + + public void CreateShortcuts() + { + portabilityUpdater.CreateShortcutsForExecutable(exeName, ShortcutLocation.StartMenu, false); + portabilityUpdater.CreateShortcutsForExecutable(exeName, ShortcutLocation.Desktop, false); + portabilityUpdater.CreateShortcutsForExecutable(exeName, ShortcutLocation.Startup, false); + } + + public void CreateUninstallerEntry() + { + portabilityUpdater.CreateUninstallerRegistryEntry(); + } } }