From 6d034bda825c506bede7bf0229f47095222edfc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 5 Dec 2017 09:52:04 +0100 Subject: GH-2059 fix instance directory not being created on first launch --- api/logic/FolderInstanceProvider.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'api/logic/FolderInstanceProvider.cpp') 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); -- cgit v1.2.3