From 1230df1ef6b1cdec92ec2d64fecdcafdc6feb975 Mon Sep 17 00:00:00 2001 From: meepingsnesroms Date: Mon, 30 Jul 2018 12:26:44 -0700 Subject: [PATCH] Create resource directory if missing every time not just on first launch --- qtBuildSystem/Mu/mainwindow.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/qtBuildSystem/Mu/mainwindow.cpp b/qtBuildSystem/Mu/mainwindow.cpp index b36f714..f52d6d0 100644 --- a/qtBuildSystem/Mu/mainwindow.cpp +++ b/qtBuildSystem/Mu/mainwindow.cpp @@ -53,22 +53,24 @@ MainWindow::MainWindow(QWidget* parent) : ui->ctrlBtn->setIcon(QIcon(":/buttons/images/play.png")); - //set resource directory if first launch - if(settings.value("resourceDirectory", "").toString() == ""){ - QString path; + QString resourceDirPath = settings.value("resourceDirectory", "").toString(); + //use default path if path not set + if(resourceDirPath == ""){ #if defined(Q_OS_ANDROID) - path = "/sdcard/Mu"; + resourceDirPath = "/sdcard/Mu"; #elif defined(Q_OS_IOS) - path = "/var/mobile/Media/Mu"; + resourceDirPath = "/var/mobile/Media/Mu"; #else - path = QDir::homePath() + "/Mu"; + resourceDirPath = QDir::homePath() + "/Mu"; #endif - - settings.setValue("resourceDirectory", path); - QDir(path).mkpath("."); + settings.setValue("resourceDirectory", resourceDirPath); } + //create path if it doesnt exist + if(!QDir(resourceDirPath).exists()) + QDir(resourceDirPath).mkpath("."); + #if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) ui->debugger->hide();