|
@@ -30,7 +30,18 @@ struct ctkCmdLineModuleDefaultPathBuilderPrivate
|
|
public:
|
|
public:
|
|
ctkCmdLineModuleDefaultPathBuilderPrivate();
|
|
ctkCmdLineModuleDefaultPathBuilderPrivate();
|
|
~ctkCmdLineModuleDefaultPathBuilderPrivate();
|
|
~ctkCmdLineModuleDefaultPathBuilderPrivate();
|
|
- QStringList build();
|
|
|
|
|
|
+ QStringList build() const;
|
|
|
|
+
|
|
|
|
+ void setLoadFromHomeDir(const bool& doLoad);
|
|
|
|
+ void setLoadFromCurrentDir(const bool& doLoad);
|
|
|
|
+ void setLoadFromApplicationDir(const bool& doLoad);
|
|
|
|
+ void setLoadFromCtkModuleLoadPath(const bool& doLoad);
|
|
|
|
+
|
|
|
|
+ bool LoadFromHomeDir;
|
|
|
|
+ bool LoadFromCurrentDir;
|
|
|
|
+ bool LoadFromApplicationDir;
|
|
|
|
+ bool LoadFromCtkModuleLoadPath;
|
|
|
|
+
|
|
};
|
|
};
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
@@ -38,6 +49,10 @@ public:
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
ctkCmdLineModuleDefaultPathBuilderPrivate::ctkCmdLineModuleDefaultPathBuilderPrivate()
|
|
ctkCmdLineModuleDefaultPathBuilderPrivate::ctkCmdLineModuleDefaultPathBuilderPrivate()
|
|
|
|
+: LoadFromHomeDir(false)
|
|
|
|
+, LoadFromCurrentDir(false)
|
|
|
|
+, LoadFromApplicationDir(false)
|
|
|
|
+, LoadFromCtkModuleLoadPath(false)
|
|
{
|
|
{
|
|
|
|
|
|
}
|
|
}
|
|
@@ -49,36 +64,73 @@ ctkCmdLineModuleDefaultPathBuilderPrivate::~ctkCmdLineModuleDefaultPathBuilderPr
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
-QStringList ctkCmdLineModuleDefaultPathBuilderPrivate::build()
|
|
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilderPrivate::setLoadFromHomeDir(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ LoadFromHomeDir = doLoad;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilderPrivate::setLoadFromCurrentDir(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ LoadFromCurrentDir = doLoad;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilderPrivate::setLoadFromApplicationDir(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ LoadFromApplicationDir = doLoad;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilderPrivate::setLoadFromCtkModuleLoadPath(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ LoadFromCtkModuleLoadPath = doLoad;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+QStringList ctkCmdLineModuleDefaultPathBuilderPrivate::build() const
|
|
{
|
|
{
|
|
QStringList result;
|
|
QStringList result;
|
|
|
|
|
|
QString suffix = "cli-modules";
|
|
QString suffix = "cli-modules";
|
|
|
|
|
|
- char *ctkModuleLoadPath = getenv("CTK_MODULE_LOAD_PATH");
|
|
|
|
- if (ctkModuleLoadPath != NULL)
|
|
|
|
|
|
+ if (LoadFromCtkModuleLoadPath)
|
|
{
|
|
{
|
|
- QDir dir = QDir(QString(ctkModuleLoadPath));
|
|
|
|
- if (dir.exists())
|
|
|
|
|
|
+ char *ctkModuleLoadPath = getenv("CTK_MODULE_LOAD_PATH");
|
|
|
|
+ if (ctkModuleLoadPath != NULL)
|
|
{
|
|
{
|
|
- result << dir.canonicalPath();
|
|
|
|
|
|
+ QDir dir = QDir(QString(ctkModuleLoadPath));
|
|
|
|
+ if (dir.exists())
|
|
|
|
+ {
|
|
|
|
+ result << dir.canonicalPath();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if (QDir::home().exists())
|
|
|
|
|
|
+ if (LoadFromHomeDir)
|
|
{
|
|
{
|
|
- result << QDir::homePath();
|
|
|
|
- result << QDir::homePath() + QDir::separator() + suffix;
|
|
|
|
|
|
+ if (QDir::home().exists())
|
|
|
|
+ {
|
|
|
|
+ result << QDir::homePath();
|
|
|
|
+ result << QDir::homePath() + QDir::separator() + suffix;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- if (QDir::current().exists())
|
|
|
|
|
|
+ if (LoadFromCurrentDir)
|
|
{
|
|
{
|
|
- result << QDir::currentPath();
|
|
|
|
- result << QDir::currentPath() + QDir::separator() + suffix;
|
|
|
|
|
|
+ if (QDir::current().exists())
|
|
|
|
+ {
|
|
|
|
+ result << QDir::currentPath();
|
|
|
|
+ result << QDir::currentPath() + QDir::separator() + suffix;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- result << QCoreApplication::applicationDirPath();
|
|
|
|
- result << QCoreApplication::applicationDirPath() + QDir::separator() + suffix;
|
|
|
|
|
|
+ if (LoadFromApplicationDir)
|
|
|
|
+ {
|
|
|
|
+ result << QCoreApplication::applicationDirPath();
|
|
|
|
+ result << QCoreApplication::applicationDirPath() + QDir::separator() + suffix;
|
|
|
|
+ }
|
|
|
|
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -98,7 +150,31 @@ ctkCmdLineModuleDefaultPathBuilder::~ctkCmdLineModuleDefaultPathBuilder()
|
|
}
|
|
}
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
-QStringList ctkCmdLineModuleDefaultPathBuilder::build()
|
|
|
|
|
|
+QStringList ctkCmdLineModuleDefaultPathBuilder::build() const
|
|
{
|
|
{
|
|
return d->build();
|
|
return d->build();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilder::setLoadFromHomeDir(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ d->setLoadFromHomeDir(doLoad);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilder::setLoadFromCurrentDir(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ d->setLoadFromCurrentDir(doLoad);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilder::setLoadFromApplicationDir(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ d->setLoadFromApplicationDir(doLoad);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//-----------------------------------------------------------------------------
|
|
|
|
+void ctkCmdLineModuleDefaultPathBuilder::setLoadFromCtkModuleLoadPath(const bool& doLoad)
|
|
|
|
+{
|
|
|
|
+ d->setLoadFromCtkModuleLoadPath(doLoad);
|
|
|
|
+}
|