summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-12-03 02:38:53 +0100
committerPetr Mrázek <peterix@gmail.com>2017-12-03 02:38:53 +0100
commit30fad998a6795752911e69906f414bd52c6aa2ad (patch)
treeaf4606ead2e4e5e2afe4d28f4352e25dc14978fc /api
parent34de313feb46c08449e8d1f89f934f2a4a1afa14 (diff)
downloadMultiMC-30fad998a6795752911e69906f414bd52c6aa2ad.tar
MultiMC-30fad998a6795752911e69906f414bd52c6aa2ad.tar.gz
MultiMC-30fad998a6795752911e69906f414bd52c6aa2ad.tar.lz
MultiMC-30fad998a6795752911e69906f414bd52c6aa2ad.tar.xz
MultiMC-30fad998a6795752911e69906f414bd52c6aa2ad.zip
NOISSUE normalize instances path in FolderInstanceProvider
This resolves some issues with the instance export dialog when the instances folder path contains '..' and '.', or involves symlinks.
Diffstat (limited to 'api')
-rw-r--r--api/logic/FolderInstanceProvider.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/api/logic/FolderInstanceProvider.cpp b/api/logic/FolderInstanceProvider.cpp
index 53618439..296b366e 100644
--- a/api/logic/FolderInstanceProvider.cpp
+++ b/api/logic/FolderInstanceProvider.cpp
@@ -34,7 +34,8 @@ struct WatchLock
FolderInstanceProvider::FolderInstanceProvider(SettingsObjectPtr settings, const QString& instDir)
: BaseInstanceProvider(settings)
{
- m_instDir = instDir;
+ // Normalize path
+ m_instDir = QDir(instDir).canonicalPath();
if (!QDir::current().exists(m_instDir))
{
QDir::current().mkpath(m_instDir);
@@ -281,7 +282,7 @@ void FolderInstanceProvider::instanceDirContentsChanged(const QString& path)
void FolderInstanceProvider::on_InstFolderChanged(const Setting &setting, QVariant value)
{
- QString newInstDir = value.toString();
+ QString newInstDir = QDir(value.toString()).canonicalPath();
if(newInstDir != m_instDir)
{
if(m_groupsLoaded)