From 6a7fc0a0f190922c61081c57b1b5bfa289f34de0 Mon Sep 17 00:00:00 2001 From: darco Date: Mon, 11 Apr 2005 23:46:39 +0000 Subject: [PATCH] Added support for the SYNFIG_MODULE_LIST environment variable. git-svn-id: http://svn.voria.com/code@14 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/macosxbuild.sh | 2 +- synfig-core/trunk/src/sinfg/main.cpp | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/synfig-core/trunk/macosxbuild.sh b/synfig-core/trunk/macosxbuild.sh index fd50599..b6b254d 100755 --- a/synfig-core/trunk/macosxbuild.sh +++ b/synfig-core/trunk/macosxbuild.sh @@ -13,7 +13,7 @@ BUILDDIR=macosxbuild [ -e configure ] || ./bootstrap || exit 1 -# [ -d $BUILDDIR ] && rm -fr $BUILDDIR +[ -d $BUILDDIR ] && rm -fr $BUILDDIR mkdir $BUILDDIR diff --git a/synfig-core/trunk/src/sinfg/main.cpp b/synfig-core/trunk/src/sinfg/main.cpp index db576fd..b253c3b 100644 --- a/synfig-core/trunk/src/sinfg/main.cpp +++ b/synfig-core/trunk/src/sinfg/main.cpp @@ -279,6 +279,33 @@ sinfg::Main::Main(const sinfg::String& basepath,ProgressCallback *cb): // Load up the modules std::list modules_to_load; + std::vector locations; + + if(!getenv("SYNFIG_MODULE_LIST")) + { + locations.push_back("standard"); + locations.push_back("./"MODULE_LIST_FILENAME); //1 + locations.push_back("../etc/"MODULE_LIST_FILENAME); //1 + locations.push_back("~/.sinfg/"MODULE_LIST_FILENAME); //2 + locations.push_back(prefix+"/etc/"+MODULE_LIST_FILENAME); //3 + locations.push_back("/usr/local/etc/"MODULE_LIST_FILENAME); + #ifdef SYSCONFDIR + locations.push_back(SYSCONFDIR"/"MODULE_LIST_FILENAME); + #endif + #ifdef __APPLE__ + locations.push_back("/Library/Frameworks/synfig.framework/Resources/"MODULE_LIST_FILENAME); + locations.push_back("/Library/Synfig/"MODULE_LIST_FILENAME); + locations.push_back("~/Library/Synfig/"MODULE_LIST_FILENAME); + #endif + #ifdef WIN32 + locations.push_back("C:\\Program Files\\Synfig\\etc\\"MODULE_LIST_FILENAME); + #endif + } + else + { + locations.push_back(getenv("SYNFIG_MODULE_LIST")); + } +/* const char *locations[]= { "standard", //0 @@ -299,12 +326,11 @@ sinfg::Main::Main(const sinfg::String& basepath,ProgressCallback *cb): "C:\\Program Files\\SINFG\\etc\\"MODULE_LIST_FILENAME, #endif }; - String module_path=prefix+"/etc/"+MODULE_LIST_FILENAME; - locations[3]=module_path.c_str(); +*/ - for(i=0;i<(signed)(sizeof(locations)/sizeof(char*));i++) + for(i=0;itask(strprintf(_("Loading modules from %s"),locations[i])); + if(cb)cb->task(strprintf(_("Loading modules from %s"),locations[i].c_str())); std::list::iterator iter; -- 2.7.4