mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 03:07:04 +02:00
Fix applicationDirectory issues and add plugin debuggerMode
This commit is contained in:
@@ -83,6 +83,11 @@ namespace Wox
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Args.Length > 0 && e.Args[0].ToLower() == "plugindebugger")
|
||||
{
|
||||
var path = e.Args[1];
|
||||
PluginLoader.Plugins.ActivatePluginDebugger(path);
|
||||
}
|
||||
|
||||
window = new MainWindow();
|
||||
if (e.Args.Length == 0 || e.Args[0].ToLower() != "hidestart")
|
||||
|
||||
@@ -424,7 +424,7 @@ namespace Wox
|
||||
{
|
||||
var dict = new ResourceDictionary
|
||||
{
|
||||
Source = new Uri(Path.Combine(Directory.GetCurrentDirectory(), "Themes\\" + themeName + ".xaml"), UriKind.Absolute)
|
||||
Source = new Uri(Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Themes\\" + themeName + ".xaml"), UriKind.Absolute)
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Wox.PluginLoader
|
||||
{
|
||||
public abstract class BasePluginLoader
|
||||
{
|
||||
private static string PluginPath = AppDomain.CurrentDomain.BaseDirectory + "Plugins";
|
||||
private static string PluginPath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Plugins");
|
||||
private static string PluginConfigName = "plugin.json";
|
||||
protected static List<PluginMetadata> pluginMetadatas = new List<PluginMetadata>();
|
||||
public abstract List<PluginPair> LoadPlugin();
|
||||
@@ -23,6 +23,12 @@ namespace Wox.PluginLoader
|
||||
pluginMetadatas.Clear();
|
||||
ParseSystemPlugins();
|
||||
ParseThirdPartyPlugins();
|
||||
|
||||
if (Plugins.DebuggerMode != null)
|
||||
{
|
||||
PluginMetadata metadata = GetMetadataFromJson(Plugins.DebuggerMode);
|
||||
if (metadata != null) pluginMetadatas.Add(metadata);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParseSystemPlugins()
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Wox.PluginLoader
|
||||
{
|
||||
public static class Plugins
|
||||
{
|
||||
private static string debuggerMode = null;
|
||||
private static List<PluginPair> plugins = new List<PluginPair>();
|
||||
|
||||
public static void Init()
|
||||
@@ -68,5 +69,15 @@ namespace Wox.PluginLoader
|
||||
|
||||
return plugins.Any(o => o.Metadata.PluginType == PluginType.ThirdParty && o.Metadata.ActionKeyword == query.ActionName);
|
||||
}
|
||||
|
||||
public static void ActivatePluginDebugger(string path)
|
||||
{
|
||||
debuggerMode = path;
|
||||
}
|
||||
|
||||
public static String DebuggerMode
|
||||
{
|
||||
get { return debuggerMode; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Wox.PluginLoader
|
||||
|
||||
private void SetPythonHome()
|
||||
{
|
||||
//Environment.SetEnvironmentVariable("PYTHONHOME",Path.Combine(Directory.GetCurrentDirectory(),"PythonHome"));
|
||||
//Environment.SetEnvironmentVariable("PYTHONHOME",Path.Combine(Path.GetDirectoryName(Application.ExecutablePath),"PythonHome"));
|
||||
//PythonEngine.PythonHome =
|
||||
//PythonEngine.ProgramName
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace Wox
|
||||
|
||||
private List<string> LoadAvailableThemes()
|
||||
{
|
||||
string themePath = Directory.GetCurrentDirectory() + "\\Themes\\";
|
||||
string themePath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Themes");
|
||||
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml") && !filePath.EndsWith("Default.xaml")).ToList();
|
||||
}
|
||||
|
||||
@@ -244,9 +244,9 @@ namespace Wox
|
||||
IWshShortcut shortcut = (IWshShortcut)wshShell.CreateShortcut(woxLinkPath);
|
||||
shortcut.TargetPath = Application.ExecutablePath;
|
||||
shortcut.Arguments = "hideStart";
|
||||
shortcut.WorkingDirectory = Application.StartupPath;
|
||||
shortcut.WorkingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
|
||||
shortcut.Description = "Launch Wox";
|
||||
shortcut.IconLocation = Application.StartupPath + @"\App.ico";
|
||||
shortcut.IconLocation = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "App.ico");
|
||||
shortcut.Save();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user