summaryrefslogtreecommitdiffstats
path: root/api/logic/FolderInstanceProvider.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-12-05 09:52:04 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-05 09:52:04 +0100
commit6d034bda825c506bede7bf0229f47095222edfc2 (patch)
treee305701ed2eb2afb080ade007d3fe1668f1cfa4e /api/logic/FolderInstanceProvider.cpp
parent44475350ebfed97f6b0cb14c1e62c8ef67fb9a31 (diff)
downloadMultiMC-6d034bda825c506bede7bf0229f47095222edfc2.tar
MultiMC-6d034bda825c506bede7bf0229f47095222edfc2.tar.gz
MultiMC-6d034bda825c506bede7bf0229f47095222edfc2.tar.lz
MultiMC-6d034bda825c506bede7bf0229f47095222edfc2.tar.xz
MultiMC-6d034bda825c506bede7bf0229f47095222edfc2.zip
GH-2059 fix instance directory not being created on first launch
Diffstat (limited to 'api/logic/FolderInstanceProvider.cpp')
-rw-r--r--api/logic/FolderInstanceProvider.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/api/logic/FolderInstanceProvider.cpp b/api/logic/FolderInstanceProvider.cpp
index 296b366e..74ac456a 100644
--- a/api/logic/FolderInstanceProvider.cpp
+++ b/api/logic/FolderInstanceProvider.cpp
@@ -34,12 +34,13 @@ struct WatchLock
FolderInstanceProvider::FolderInstanceProvider(SettingsObjectPtr settings, const QString& instDir)
: BaseInstanceProvider(settings)
{
- // Normalize path
- m_instDir = QDir(instDir).canonicalPath();
- if (!QDir::current().exists(m_instDir))
+ // Create aand normalize path
+ if (!QDir::current().exists(instDir))
{
- QDir::current().mkpath(m_instDir);
+ QDir::current().mkpath(instDir);
}
+ // NOTE: canonicalPath requires the path to exist. Do not move this above the creation block!
+ m_instDir = QDir(instDir).canonicalPath();
m_watcher = new QFileSystemWatcher(this);
connect(m_watcher, &QFileSystemWatcher::directoryChanged, this, &FolderInstanceProvider::instanceDirContentsChanged);
m_watcher->addPath(m_instDir);