Add plugin path, separate search plugins
[WebThing.git] / Config.cs
index a4332e1..b8f04cd 100644 (file)
--- a/Config.cs
+++ b/Config.cs
@@ -18,12 +18,14 @@ namespace bytex64.WebThing {
     public class Config {
         public static List<string> ConfigPath;
         public static string ConfigPathOut = null;
+        public static List<string> PluginPath;
 
         public static Dictionary<string,string> Options;
         public static Dictionary<string,Dictionary<string,string>> PluginOptions;
         public static string[] Arguments;
         public static List<string> Plugins;
         public static List<SearchHandlerPair> SearchHandlers;
+        public static string DefaultSearchHandler;
 
         private static HashSet<string> CommandLineOptions;
         private static Regex item_re = new Regex(@"^(?:([\w.]+)\.)?(\w+)$");
@@ -54,6 +56,11 @@ namespace bytex64.WebThing {
                 if (Directory.Exists(homepath))
                     ConfigPathOut = homepath;
             }
+
+            // Set up PluginPath
+            PluginPath = new List<string>();
+            PluginPath.Add(Environment.GetEnvironmentVariable("WEBTHING_HOME") + "/plugins");
+            PluginPath.Add(Environment.GetEnvironmentVariable("WEBTHING_HOME") + "/searchplugins");
         }
 
         private static void ParseOption(string key, string val) {
@@ -193,6 +200,9 @@ namespace bytex64.WebThing {
                         }
                         SearchHandlers.Add(new SearchHandlerPair(args[0], args[1]));
                         break;
+                    case "defaultsearchhandler":
+                        DefaultSearchHandler = m.Groups[2].Value;
+                        break;
                     default:
                         Console.WriteLine("Unknown Command in {0}: {1}", filename, line);
                         break;