mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-04 04:40:56 -06:00
cmake-gui: Explicitly normalize input paths as they exist on disk
This commit is contained in:
@@ -172,8 +172,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
sourceDirectory = cmSystemTools::CollapseFullPath(path.toStdString());
|
||||
cmSystemTools::ConvertToUnixSlashes(sourceDirectory);
|
||||
sourceDirectory =
|
||||
cmSystemTools::ToNormalizedPathOnDisk(path.toStdString());
|
||||
} else if (arg.startsWith("-B")) {
|
||||
QString path = arg.mid(2);
|
||||
if (path.isEmpty()) {
|
||||
@@ -189,8 +189,8 @@ int main(int argc, char** argv)
|
||||
}
|
||||
}
|
||||
|
||||
binaryDirectory = cmSystemTools::CollapseFullPath(path.toStdString());
|
||||
cmSystemTools::ConvertToUnixSlashes(binaryDirectory);
|
||||
binaryDirectory =
|
||||
cmSystemTools::ToNormalizedPathOnDisk(path.toStdString());
|
||||
} else if (arg.startsWith("--preset=")) {
|
||||
QString preset = arg.mid(cmStrLen("--preset="));
|
||||
if (preset.isEmpty()) {
|
||||
@@ -223,7 +223,7 @@ int main(int argc, char** argv)
|
||||
} else {
|
||||
if (args.count() == 2) {
|
||||
std::string filePath =
|
||||
cmSystemTools::CollapseFullPath(args[1].toStdString());
|
||||
cmSystemTools::ToNormalizedPathOnDisk(args[1].toStdString());
|
||||
|
||||
// check if argument is a directory containing CMakeCache.txt
|
||||
std::string buildFilePath = cmStrCat(filePath, "/CMakeCache.txt");
|
||||
@@ -243,7 +243,7 @@ int main(int argc, char** argv)
|
||||
} else if (cmSystemTools::FileExists(srcFilePath.c_str())) {
|
||||
dialog.setSourceDirectory(QString::fromStdString(filePath));
|
||||
dialog.setBinaryDirectory(
|
||||
QString::fromStdString(cmSystemTools::CollapseFullPath(".")));
|
||||
QString::fromStdString(cmSystemTools::GetCurrentWorkingDirectory()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,9 +258,7 @@ void QCMake::configure()
|
||||
#endif
|
||||
// Apply the same transformations that the command-line invocation does
|
||||
auto sanitizePath = [](QString const& value) -> std::string {
|
||||
std::string path = cmSystemTools::CollapseFullPath(value.toStdString());
|
||||
cmSystemTools::ConvertToUnixSlashes(path);
|
||||
return path;
|
||||
return cmSystemTools::ToNormalizedPathOnDisk(value.toStdString());
|
||||
};
|
||||
|
||||
this->CMakeInstance->SetHomeDirectory(sanitizePath(this->SourceDirectory));
|
||||
|
||||
Reference in New Issue
Block a user