forked from qt-creator/qt-creator
FilePath: Use isSameDevice
Some places compared the scheme and host of a filepath to decide whether its the same device. This is incorrect and leads to false negatives. isSameDevice is the correct way to decide whether two paths are from the same device. Fixes: QTCREATORBUG-29474 Change-Id: Iced8f434dadb931f6595f47f95647b341c48d3aa Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -722,8 +722,7 @@ bool FileUtils::copyRecursively(
|
|||||||
bool FileUtils::copyIfDifferent(const FilePath &srcFilePath, const FilePath &tgtFilePath)
|
bool FileUtils::copyIfDifferent(const FilePath &srcFilePath, const FilePath &tgtFilePath)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(srcFilePath.exists(), return false);
|
QTC_ASSERT(srcFilePath.exists(), return false);
|
||||||
QTC_ASSERT(srcFilePath.scheme() == tgtFilePath.scheme(), return false);
|
QTC_ASSERT(srcFilePath.isSameDevice(tgtFilePath), return false);
|
||||||
QTC_ASSERT(srcFilePath.host() == tgtFilePath.host(), return false);
|
|
||||||
|
|
||||||
if (tgtFilePath.exists()) {
|
if (tgtFilePath.exists()) {
|
||||||
const QDateTime srcModified = srcFilePath.lastModified();
|
const QDateTime srcModified = srcFilePath.lastModified();
|
||||||
|
@@ -1204,7 +1204,7 @@ FilePath Process::workingDirectory() const
|
|||||||
void Process::setWorkingDirectory(const FilePath &dir)
|
void Process::setWorkingDirectory(const FilePath &dir)
|
||||||
{
|
{
|
||||||
if (dir.needsDevice() && d->m_setup.m_commandLine.executable().needsDevice()) {
|
if (dir.needsDevice() && d->m_setup.m_commandLine.executable().needsDevice()) {
|
||||||
QTC_CHECK(dir.host() == d->m_setup.m_commandLine.executable().host());
|
QTC_CHECK(dir.isSameDevice(d->m_setup.m_commandLine.executable()));
|
||||||
}
|
}
|
||||||
d->m_setup.m_workingDirectory = dir;
|
d->m_setup.m_workingDirectory = dir;
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (buildDirectory.needsDevice()) {
|
if (buildDirectory.needsDevice()) {
|
||||||
if (cmake->cmakeExecutable().host() != buildDirectory.host()) {
|
if (!cmake->cmakeExecutable().isSameDevice(buildDirectory)) {
|
||||||
const QString msg = ::CMakeProjectManager::Tr::tr(
|
const QString msg = ::CMakeProjectManager::Tr::tr(
|
||||||
"CMake executable \"%1\" and build directory \"%2\" must be on the same device.")
|
"CMake executable \"%1\" and build directory \"%2\" must be on the same device.")
|
||||||
.arg(cmake->cmakeExecutable().toUserOutput(), buildDirectory.toUserOutput());
|
.arg(cmake->cmakeExecutable().toUserOutput(), buildDirectory.toUserOutput());
|
||||||
|
Reference in New Issue
Block a user