diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sdk/installerbasecommons.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/sdk/installerbasecommons.cpp b/src/sdk/installerbasecommons.cpp index 9e8b8ab12..214b6e54b 100644 --- a/src/sdk/installerbasecommons.cpp +++ b/src/sdk/installerbasecommons.cpp @@ -371,15 +371,22 @@ QString TargetDirectoryPageImpl::targetDirWarning() const "absolute path."); } - QString dir = targetDir(); - QString ambiguousChars = QLatin1String("[<>|?*!@#$%^&:,; ]"); - if (packageManagerCore()->settings().allowSpaceInPath()) - ambiguousChars.remove(QLatin1Char(' ')); - + QString dir = QDir::toNativeSeparators(targetDir()); #ifdef Q_OS_WIN + if (dir.count() >= 3 && dir.indexOf(QRegExp(QLatin1String("[a-zA-Z]:"))) == 0 + && dir.at(2) != QLatin1Char('\\')) { + return TargetDirectoryPageImpl::tr("The path you have entered is not valid, please make sure to " + "specify a valid drive."); + } + // remove e.g. "c:" dir = dir.mid(2); #endif + + QString ambiguousChars = QLatin1String("[<>|?*!@#$%^&:,; ]"); + if (packageManagerCore()->settings().allowSpaceInPath()) + ambiguousChars.remove(QLatin1Char(' ')); + // check if there are not allowed characters in the target path if (dir.contains(QRegExp(ambiguousChars))) { return TargetDirectoryPageImpl::tr("The installation path must not contain %1, " |