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 );
85 foreach( QString pluginfile, dir.entryList() ) {
86 if ( ! QLibrary::isLibrary( pluginfile ) )
continue;
87 if ( loadPlugin( dir.absoluteFilePath(pluginfile) ) ) {
95 foreach( QString path, pluginPaths ) {
96 QString value = params.
getValue(
"TOTAL99/"+path );
97 if ( ! QFileInfo( value ).isDir() ) {
98 Logger::warning(
"Ignoring un-existing plugin path \"" + value +
"\"" );
101 loadPlugins( QDir( value ) );
107 confBasePath = qApp->applicationDirPath() +
"/../conf";
108 pluginBasePath = qApp->applicationDirPath() +
"/../plugins";
110 confBasePath = qApp->applicationDirPath() +
"/../share/FARSA/conf";
111 pluginBasePath = qApp->applicationDirPath() +
"/../share/FARSA/plugins";
114 confUserPath = QString(getenv(
"HOME")) +
"/.FARSA/total99";
115 pluginUserPath = QString(getenv(
"HOME")) +
"/.FARSA/total99/plugins";
118 confUserPath = QString(getenv(
"HOME")) +
"/Library/Application Support/FARSA/Total99";
119 pluginUserPath = QString(getenv(
"HOME")) +
"/Library/Application Support/FARSA/Total99/plugins";
122 confUserPath = QString(getenv(
"APPDATA")) +
"/FARSA/Total99";
123 pluginUserPath = QString(getenv(
"APPDATA")) +
"/FARSA/Total99/plugins";
127 dir.mkpath( confUserPath );
128 dir.mkpath( pluginUserPath );
131 loadPlugins( QDir( pluginBasePath ) );
132 loadPlugins( QDir( pluginUserPath ) );
139 #if defined(_MSC_VER)