|
@@ -35,17 +35,10 @@
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
|
|
-//database name
|
|
|
-#define PLUGINDATABASE "pluginfw.db"
|
|
|
-
|
|
|
//database table names
|
|
|
#define PLUGINS_TABLE "Plugins"
|
|
|
#define PLUGIN_RESOURCES_TABLE "PluginResources"
|
|
|
|
|
|
-//separator
|
|
|
-#define PLUGINDATABASE_PATH_SEPARATOR "//"
|
|
|
-
|
|
|
-
|
|
|
|
|
|
enum TBindIndexes
|
|
|
{
|
|
@@ -527,16 +520,27 @@ QString ctkPluginDatabase::getDatabasePath() const
|
|
|
QString path;
|
|
|
if(m_databasePath.isEmpty())
|
|
|
{
|
|
|
- QSettings settings(QSettings::UserScope, "commontk", QApplication::applicationName());
|
|
|
+ QSettings settings;
|
|
|
path = settings.value("PluginDB/Path").toString();
|
|
|
if (path.isEmpty())
|
|
|
{
|
|
|
- path = QDir::currentPath();
|
|
|
- if (path.lastIndexOf(PLUGINDATABASE_PATH_SEPARATOR) != path.length() -1)
|
|
|
+ path = QApplication::applicationDirPath();
|
|
|
+ if (path.lastIndexOf("/") != path.length() -1)
|
|
|
+ {
|
|
|
+ path.append("/");
|
|
|
+ }
|
|
|
+ QString appName = QApplication::applicationName();
|
|
|
+ appName.replace(" ", "");
|
|
|
+ if (!appName.isEmpty())
|
|
|
+ {
|
|
|
+ path.append(appName + "_plugins.db");
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- path.append(PLUGINDATABASE_PATH_SEPARATOR);
|
|
|
+ path.append("pluginfw.db");
|
|
|
+ qWarning() << "Warning: Using generic plugin database name. You should "
|
|
|
+ "set an application name via QCoreApplication::setApplicationName()";
|
|
|
}
|
|
|
- path.append(PLUGINDATABASE);
|
|
|
}
|
|
|
path = QDir::toNativeSeparators(path);
|
|
|
}
|