diff options
author | Loetkolben <sirloetkolben@gmail.com> | 2014-07-27 15:50:03 +0200 |
---|---|---|
committer | Jan Dalheimer <jan@dalheimer.de> | 2014-07-30 21:40:18 +0200 |
commit | c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f (patch) | |
tree | 113e3561122c70b51e97b530c8055bdf91533cb8 /depends | |
parent | e5b393318fb2a143c9520928dd45c697af68f498 (diff) | |
download | MultiMC-c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f.tar MultiMC-c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f.tar.gz MultiMC-c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f.tar.lz MultiMC-c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f.tar.xz MultiMC-c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f.zip |
Show a warning if the instance path contains a '!'
The checks and warnings happen the time MMC loads (via QLOG_INFO), the time the GUI starts (via a dialog) and when the user changes the instance path via the settings window.
Diffstat (limited to 'depends')
-rw-r--r-- | depends/util/include/pathutils.h | 4 | ||||
-rw-r--r-- | depends/util/src/pathutils.cpp | 8 |
2 files changed, 12 insertions, 0 deletions
diff --git a/depends/util/include/pathutils.h b/depends/util/include/pathutils.h index 45c2a6de..f5990b85 100644 --- a/depends/util/include/pathutils.h +++ b/depends/util/include/pathutils.h @@ -16,6 +16,7 @@ #pragma once #include <QString> +#include <QDir> #include "libutil_config.h" @@ -57,3 +58,6 @@ LIBUTIL_EXPORT void openFileInDefaultProgram(QString filename); /// Opens the given directory in the default application. LIBUTIL_EXPORT void openDirInDefaultProgram(QString dirpath, bool ensureExists = false); + +/// Checks if the a given Path contains "!" +LIBUTIL_EXPORT bool checkProblemticPathJava(QDir folder); diff --git a/depends/util/src/pathutils.cpp b/depends/util/src/pathutils.cpp index 1d09fe45..ba66898e 100644 --- a/depends/util/src/pathutils.cpp +++ b/depends/util/src/pathutils.cpp @@ -144,3 +144,11 @@ void openFileInDefaultProgram(QString filename) { QDesktopServices::openUrl(QUrl::fromLocalFile(filename)); } + +// Does the directory path contain any '!'? If yes, return true, otherwise false. +// (This is a problem for Java) +bool checkProblemticPathJava(QDir folder) +{ + QString pathfoldername = folder.absolutePath(); + return pathfoldername.contains("!", Qt::CaseInsensitive); +} |