Use QDir instead of putting together strings
This commit is contained in:
parent
d7649ea32b
commit
038ca10eab
1 changed files with 8 additions and 6 deletions
14
src/main.cpp
14
src/main.cpp
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
@ -17,16 +18,17 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
auto args = parser.positionalArguments();
|
auto args = parser.positionalArguments();
|
||||||
|
|
||||||
if (args.size() < 1) {
|
if (args.empty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString sitePath = args[0];
|
const QDir sitePath = args[0];
|
||||||
QString defPath = QString("%1/art").arg(sitePath);
|
const QString defPath = sitePath.absoluteFilePath("art");
|
||||||
QString assetPath = QString("%1/assets/art").arg(sitePath);
|
const QDir assetPath = sitePath.absoluteFilePath("assets");
|
||||||
QString dataPath = QString("%1/data").arg(sitePath);
|
const QString artAssetPath = assetPath.absoluteFilePath("art");
|
||||||
|
const QString dataPath = sitePath.absoluteFilePath("data");
|
||||||
|
|
||||||
MainWindow window(defPath, assetPath, dataPath);
|
MainWindow window(defPath, artAssetPath, dataPath);
|
||||||
window.show();
|
window.show();
|
||||||
|
|
||||||
return QApplication::exec();
|
return QApplication::exec();
|
||||||
|
|
Reference in a new issue