From ba0bda6aa6645c3459b01ff4f0ece42656fc583f Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Mon, 29 Dec 2014 21:55:27 +0800 Subject: [PATCH] Update the installer --- Deploy/Installer/Installer.iss | 14 ++++++++--- Wox.Core/Plugin/PluginManager.cs | 3 --- Wox.Core/{README.txt => README.md} | 1 + Wox.Core/Wox.Core.csproj | 2 +- Wox.Infrastructure/Storage/BaseStorage.cs | 29 ++++++++++++++++++----- Wox.Plugin/README.md | 5 ++++ Wox.Plugin/Wox.Plugin.csproj | 3 +++ Wox/App.config | 8 ++++++- Wox/Helper/WoxLogPathConverter.cs | 17 +++++++++++++ Wox/MainWindow.xaml.cs | 1 + Wox/ThemeManager.cs | 3 --- Wox/Wox.csproj | 1 + 12 files changed, 70 insertions(+), 17 deletions(-) rename Wox.Core/{README.txt => README.md} (94%) create mode 100644 Wox.Plugin/README.md create mode 100644 Wox/Helper/WoxLogPathConverter.cs diff --git a/Deploy/Installer/Installer.iss b/Deploy/Installer/Installer.iss index 21f08fd913..253572eef3 100644 --- a/Deploy/Installer/Installer.iss +++ b/Deploy/Installer/Installer.iss @@ -29,11 +29,13 @@ Name: english; MessagesFile: compiler:Default.isl Type: files; Name: "{commonstartup}\{#MyAppName}.lnk" [Tasks] -Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Flags: unchecked +Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Name: startupfolder; Description: Startup with Windows; [Files] -Source: {#MyAppPath}\*; DestDir: {app}; Flags: ignoreversion recursesubdirs +Source: {#MyAppPath}\*; Excludes: Plugins\*,Themes\*; DestDir: {app}; Flags: ignoreversion recursesubdirs +Source: {#MyAppPath}\Plugins\*; DestDir: {%USERPROFILE}\.Wox\Plugins; Flags: ignoreversion recursesubdirs +Source: {#MyAppPath}\Themes\*; DestDir: {%USERPROFILE}\.Wox\Themes; Flags: ignoreversion recursesubdirs [Icons] Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName} @@ -42,4 +44,10 @@ Name: {userdesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: deskto Name: {userstartup}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: startupfolder [Run] -Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent +Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#MyAppName}}; Flags: nowait postinstall skipifsilent unchecked + +[UninstallDelete] +Type: filesandordirs; Name: "{%USERPROFILE}\.Wox" + +[UninstallRun] +Filename: {sys}\taskkill.exe; Parameters: "/f /im Wox.exe"; Flags: skipifdoesntexist runhidden diff --git a/Wox.Core/Plugin/PluginManager.cs b/Wox.Core/Plugin/PluginManager.cs index fbe46db441..70d2918e26 100644 --- a/Wox.Core/Plugin/PluginManager.cs +++ b/Wox.Core/Plugin/PluginManager.cs @@ -46,9 +46,6 @@ namespace Wox.Core.Plugin static PluginManager() { pluginDirectories.Add(DefaultPluginDirectory); - pluginDirectories.Add( - Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Plugins")); - MakesurePluginDirectoriesExist(); } diff --git a/Wox.Core/README.txt b/Wox.Core/README.md similarity index 94% rename from Wox.Core/README.txt rename to Wox.Core/README.md index 5a0b695dc5..2c191d0856 100644 --- a/Wox.Core/README.txt +++ b/Wox.Core/README.md @@ -1,4 +1,5 @@ What does Wox.Core do? +===== * Handle Query * Loading Plugins (including system plugin and user plugin) \ No newline at end of file diff --git a/Wox.Core/Wox.Core.csproj b/Wox.Core/Wox.Core.csproj index 1aacac6d10..ce60a7f391 100644 --- a/Wox.Core/Wox.Core.csproj +++ b/Wox.Core/Wox.Core.csproj @@ -69,7 +69,7 @@ - + diff --git a/Wox.Infrastructure/Storage/BaseStorage.cs b/Wox.Infrastructure/Storage/BaseStorage.cs index d899cb6908..c72bf63c35 100644 --- a/Wox.Infrastructure/Storage/BaseStorage.cs +++ b/Wox.Infrastructure/Storage/BaseStorage.cs @@ -10,18 +10,35 @@ using Newtonsoft.Json; namespace Wox.Infrastructure.Storage { [Serializable] - public abstract class BaseStorage : IStorage where T : class,IStorage,new() + public abstract class BaseStorage : IStorage where T : class,IStorage, new() { - private readonly string configFolder = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Config"); + private string configFolder; + + private string ConfigFolder + { + get + { + if (string.IsNullOrEmpty(configFolder)) + { + string userProfilePath = Environment.GetEnvironmentVariable("USERPROFILE"); + if (userProfilePath == null) + { + throw new ArgumentException("Environment variable USERPROFILE is empty"); + } + configFolder = Path.Combine(Path.Combine(userProfilePath, ".Wox"), "Config"); + } + return configFolder; + } + } protected string ConfigPath { get { - return Path.Combine(configFolder, ConfigName + FileSuffix); + return Path.Combine(ConfigFolder, ConfigName + FileSuffix); } } - + protected abstract string FileSuffix { get; } protected abstract string ConfigName { get; } @@ -72,9 +89,9 @@ namespace Wox.Infrastructure.Storage { if (!File.Exists(ConfigPath)) { - if (!Directory.Exists(configFolder)) + if (!Directory.Exists(ConfigFolder)) { - Directory.CreateDirectory(configFolder); + Directory.CreateDirectory(ConfigFolder); } File.Create(ConfigPath).Close(); } diff --git a/Wox.Plugin/README.md b/Wox.Plugin/README.md new file mode 100644 index 0000000000..1d5c7394da --- /dev/null +++ b/Wox.Plugin/README.md @@ -0,0 +1,5 @@ +What does Wox.Plugin do? +==== + +* Define base objects and interfaces for plugins +* Plugin Author who making C# plugin should reference this DLL via nuget \ No newline at end of file diff --git a/Wox.Plugin/Wox.Plugin.csproj b/Wox.Plugin/Wox.Plugin.csproj index abc3493ebb..d915ddd7bc 100644 --- a/Wox.Plugin/Wox.Plugin.csproj +++ b/Wox.Plugin/Wox.Plugin.csproj @@ -59,6 +59,9 @@ + + +