diff --git a/config/plugins.py b/config/plugins.py index ef50bb7..e19fff9 100644 --- a/config/plugins.py +++ b/config/plugins.py @@ -1,13 +1,10 @@ #!/usr/bin/python -#plugin handler -import sys, os, glob -cwd = os.getcwd() -sys.path.append(cwd+"/lib") - import juci_to_python_api as juci +import glob + def loadplugins(): - plugin_files = glob.glob(cwd+"/plugins/*.py") + plugin_files = glob.glob("../plugins/*.py") for current_file in plugin_files: juci.initPlugin(current_file) - loadplugins() + diff --git a/src/api.cc b/src/api.cc index 4cf9242..6d6b9e2 100644 --- a/src/api.cc +++ b/src/api.cc @@ -18,12 +18,6 @@ PluginApi::PluginApi(Notebook* notebook) { DEBUG("Plugins initiated.."); } -std::string PluginApi::ProjectPath() { - int MAXPATHLEN = 50; - char temp[MAXPATHLEN]; - return ( getcwd(temp, MAXPATHLEN) ? std::string( temp ) : std::string("") ); -} - void PluginApi::ReplaceWord(std::string word) { Glib::RefPtr buffer = libjuci::BufferFromNotebook(); Gtk::TextIter word_start = libjuci::IterFromNotebook(); @@ -57,7 +51,8 @@ std::string PluginApi::GetWord() { } void PluginApi::InitPlugins() { - libjuci::LoadPlugin(ProjectPath()+"/plugins.py"); + std::string path(getenv("HOME")); + libjuci::LoadPlugin(path + "/.juci/config/plugins.py"); } void PluginApi::AddMenuElement(std::string plugin_name) { diff --git a/src/api.h b/src/api.h index 6292c07..4468631 100644 --- a/src/api.h +++ b/src/api.h @@ -16,7 +16,6 @@ public: static Menu* menu_; static Notebook* notebook; static void InitPlugins(); - static std::string ProjectPath(); // for Python module: static std::string GetWord(); // menu management