Fix applicationDirectory issues and add plugin debuggerMode

This commit is contained in:
Yeechan Lu
2014-03-22 16:50:47 +08:00
parent 9d404b6679
commit 31bbf3cfd5
12 changed files with 37 additions and 13 deletions

View File

@@ -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()

View File

@@ -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; }
}
}
}

View File

@@ -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
}