Create resource directory if missing every time not just on first launch

This commit is contained in:
meepingsnesroms
2018-07-30 12:26:44 -07:00
parent dc0aac322c
commit 1230df1ef6

View File

@@ -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();