From b3e6c81b2511caf48229905630beca50d915f505 Mon Sep 17 00:00:00 2001 From: tedjk Date: Thu, 12 Mar 2015 14:49:04 +0100 Subject: [PATCH] removed static project path --- juci/api.cc | 10 +++++++++- juci/api.h | 3 +-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/juci/api.cc b/juci/api.cc index cffae72..1057bf8 100644 --- a/juci/api.cc +++ b/juci/api.cc @@ -8,6 +8,13 @@ Notebook::Controller* PluginApi::notebook_; //// API ServiceProvider //// ///////////////////////////// +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(); @@ -44,7 +51,8 @@ std::string PluginApi::GetWord() { //runs the pythonscript that initiates every plugin within plugins/ void PluginApi::InitPlugins() { - libjuci::LoadPlugin(g_project_root+"plugins.py"); + //libjuci::LoadPlugin(g_project_root+"plugins.py"); + libjuci::LoadPlugin(ProjectPath()+"/plugins.py"); } void PluginApi::AddMenuElement(std::string plugin_name){ diff --git a/juci/api.h b/juci/api.h index 8d5f012..38f0008 100644 --- a/juci/api.h +++ b/juci/api.h @@ -7,8 +7,6 @@ #include "notebook.h" #include "menu.h" -const std::string g_project_root("/home/forgie/app/juci/"); - //////////////////// //// Plugin Api //// //////////////////// @@ -18,6 +16,7 @@ const std::string g_project_root("/home/forgie/app/juci/"); static Notebook::Controller* notebook_; static void InitPlugins(); + static std::string ProjectPath(); //for Python module: static std::string GetWord();