20 #include "total99resources.h"
22 #include <QApplication>
26 #include <QPluginLoader>
27 #include <QStringList>
28 #include "configurationparameters.h"
30 #include "farsaplugin.h"
31 #include "icubsimulator.h"
32 #include "icubsimulatorviewer.h"
33 #include "evorobotviewer.h"
40 #pragma warning(disable:4996)
43 using namespace farsa;
47 if ( QFile::exists( confUserPath +
"/" + resourceName ) ) {
48 return ( confUserPath +
"/" + resourceName );
51 if ( QFile::exists( confUserPath +
"/templates/" + uiTemplate +
"/" + resourceName ) ) {
52 return ( confUserPath +
"/templates/" + uiTemplate +
"/" + resourceName );
55 if ( QFile::exists( confBasePath +
"/" + resourceName ) ) {
56 return ( confBasePath +
"/" + resourceName );
59 if ( QFile::exists( confBasePath +
"/templates/" + uiTemplate +
"/" + resourceName ) ) {
60 return ( confBasePath +
"/templates/" + uiTemplate +
"/" + resourceName );
73 QPluginLoader loader( filename );
77 Logger::error(
"ERROR LOADING PLUGIN: "+loader.errorString() );
86 foreach( QString pluginfile, dir.entryList() ) {
87 if ( ! QLibrary::isLibrary( pluginfile ) )
continue;
88 if ( loadPlugin( dir.absoluteFilePath(pluginfile) ) ) {
96 foreach( QString path, pluginPaths ) {
97 QString value = params.
getValue(
"TOTAL99/"+path );
98 if ( ! QFileInfo( value ).isDir() ) {
99 Logger::warning(
"Ignoring un-existing plugin path \"" + value +
"\"" );
102 loadPlugins( QDir( value ) );
108 confBasePath = qApp->applicationDirPath() +
"/../conf";
109 pluginBasePath = qApp->applicationDirPath() +
"/../plugins";
111 confBasePath = qApp->applicationDirPath() +
"/../share/FARSA/conf";
112 pluginBasePath = qApp->applicationDirPath() +
"/../share/FARSA/plugins";
115 confUserPath = QString(getenv(
"HOME")) +
"/.FARSA/total99";
116 pluginUserPath = QString(getenv(
"HOME")) +
"/.FARSA/total99/plugins";
119 confUserPath = QString(getenv(
"HOME")) +
"/Library/Application Support/FARSA/Total99";
120 pluginUserPath = QString(getenv(
"HOME")) +
"/Library/Application Support/FARSA/Total99/plugins";
123 confUserPath = QString(getenv(
"APPDATA")) +
"/FARSA/Total99";
124 pluginUserPath = QString(getenv(
"APPDATA")) +
"/FARSA/Total99/plugins";
128 dir.mkpath( confUserPath );
129 dir.mkpath( pluginUserPath );
132 loadPlugins( QDir( pluginBasePath ) );
133 loadPlugins( QDir( pluginUserPath ) );
140 #if defined(_MSC_VER)