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 <QCommandLineParser>
|
||||
#include <QDir>
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
|
@ -17,16 +18,17 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
auto args = parser.positionalArguments();
|
||||
|
||||
if (args.size() < 1) {
|
||||
if (args.empty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
QString sitePath = args[0];
|
||||
QString defPath = QString("%1/art").arg(sitePath);
|
||||
QString assetPath = QString("%1/assets/art").arg(sitePath);
|
||||
QString dataPath = QString("%1/data").arg(sitePath);
|
||||
const QDir sitePath = args[0];
|
||||
const QString defPath = sitePath.absoluteFilePath("art");
|
||||
const QDir assetPath = sitePath.absoluteFilePath("assets");
|
||||
const QString artAssetPath = assetPath.absoluteFilePath("art");
|
||||
const QString dataPath = sitePath.absoluteFilePath("data");
|
||||
|
||||
MainWindow window(defPath, assetPath, dataPath);
|
||||
MainWindow window(defPath, artAssetPath, dataPath);
|
||||
window.show();
|
||||
|
||||
return QApplication::exec();
|
||||
|
|
Reference in a new issue