From c0254d9a75a1f0f784a3e9b6874475b2c2a3ab8f Mon Sep 17 00:00:00 2001 From: Loetkolben Date: Sun, 27 Jul 2014 15:50:03 +0200 Subject: 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. --- depends/util/include/pathutils.h | 4 ++++ depends/util/src/pathutils.cpp | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'depends/util') 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 +#include #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); +} -- cgit v1.2.3