From 038ca10eab9860d0eea014ae0ff7df0ada58f48c Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Thu, 31 Aug 2023 09:33:51 +0200 Subject: [PATCH] Use QDir instead of putting together strings --- src/main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index af1596b..1a32897 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ #include #include +#include #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();