Skip to content

Commit

Permalink
Look up into user plugins directory as well (~/.synfig/plugins)
Browse files Browse the repository at this point in the history
  • Loading branch information
morevnaproject committed Mar 15, 2013
1 parent bfbb257 commit eaa1cd5
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions synfig-studio/src/gui/app.cpp
Expand Up @@ -770,7 +770,10 @@ load_plugins()
DIR *dir;
struct dirent *entry;

std::list<std::string> pluginpaths;
std::string pluginsprefix;

// system plugins path
#ifdef WIN32
pluginsprefix=App::get_base_path()+ETL_DIRECTORY_SEPARATOR+PLUGIN_DIR;
#else
Expand All @@ -786,15 +789,19 @@ load_plugins()
pluginsprefix+=ETL_DIRECTORY_SEPARATOR;
pluginsprefix+="plugins";
}

synfig::info(pluginsprefix);
pluginpaths.push_back(pluginsprefix);

dir = opendir(pluginsprefix.c_str());
if(!dir) {
synfig::warning("Can't open plugins directory");
return;
}
// user plugins path
pluginsprefix=Glib::build_filename(App::get_user_app_directory(),"plugins");
pluginpaths.push_back(pluginsprefix);

for(std::list<std::string>::iterator ppath = pluginpaths.begin(); ppath != pluginpaths.end(); ++ppath){

pluginsprefix = *ppath;
synfig::info("Loading plugins from %s", pluginsprefix.c_str());

dir = opendir(pluginsprefix.c_str());
if(dir) {
while ( (entry = readdir(dir)) != NULL) {
if ( std::string(entry->d_name) != std::string(".") && std::string(entry->d_name) != std::string("..") ) {
std::string pluginpath;
Expand All @@ -818,7 +825,7 @@ load_plugins()
std::string pluginfilepath;
pluginfilepath = pluginpath+ETL_DIRECTORY_SEPARATOR+plugindirentry->d_name;

synfig::info("Found plugin - %s.", entry->d_name);
synfig::info("Loading plugin: %s", entry->d_name);

studio::App::plugin p;
p.id=entry->d_name;
Expand Down Expand Up @@ -892,7 +899,8 @@ load_plugins()
};

closedir(dir);

}
}
}

void
Expand Down

0 comments on commit eaa1cd5

Please sign in to comment.