diff options
Diffstat (limited to 'src')
59 files changed, 136 insertions, 138 deletions
diff --git a/src/libs/gocmdbridge/client/bridgedfileaccess.cpp b/src/libs/gocmdbridge/client/bridgedfileaccess.cpp index 387d7ad17de..250f4e9c42e 100644 --- a/src/libs/gocmdbridge/client/bridgedfileaccess.cpp +++ b/src/libs/gocmdbridge/client/bridgedfileaccess.cpp @@ -107,7 +107,7 @@ Result FileAccess::deployAndInit(const FilePath &libExecPath, const FilePath &re qCDebug(faLog) << deco() << "Using cmdbridge at:" << *cmdBridgePath; - if (remoteRootPath.needsDevice()) { + if (!remoteRootPath.isLocal()) { const auto cmdBridgeFileData = cmdBridgePath->fileContents(); if (!cmdBridgeFileData) { diff --git a/src/libs/utils/aspects.cpp b/src/libs/utils/aspects.cpp index 1b3bf074d1c..8d7093f921a 100644 --- a/src/libs/utils/aspects.cpp +++ b/src/libs/utils/aspects.cpp @@ -1587,7 +1587,7 @@ FilePath FilePathAspect::effectiveBinary() const if (kind != PathChooser::ExistingCommand && kind != PathChooser::Command) return current; - if (current.needsDevice()) + if (!current.isLocal()) return current; d->m_effectiveBinary.emplace(current.searchInPath()); diff --git a/src/libs/utils/devicefileaccess.cpp b/src/libs/utils/devicefileaccess.cpp index b7e7edf24a7..690fbf4522a 100644 --- a/src/libs/utils/devicefileaccess.cpp +++ b/src/libs/utils/devicefileaccess.cpp @@ -1013,7 +1013,7 @@ static bool checkToRefuseRemoveDirectory(const QDir &dir, QString *error) bool DesktopDeviceFileAccess::removeRecursively(const FilePath &filePath, QString *error) const { - QTC_ASSERT(!filePath.needsDevice(), return false); + QTC_ASSERT(filePath.isLocal(), return false); QFileInfo fileInfo = filePath.toFileInfo(); if (!fileInfo.exists() && !fileInfo.isSymLink()) return true; diff --git a/src/libs/utils/elfreader.cpp b/src/libs/utils/elfreader.cpp index 35c1a38ec12..44f0ed6ef43 100644 --- a/src/libs/utils/elfreader.cpp +++ b/src/libs/utils/elfreader.cpp @@ -86,7 +86,7 @@ ElfMapper::ElfMapper(const ElfReader *reader) bool ElfMapper::map() { - if (binary.needsDevice()) { + if (!binary.isLocal()) { const expected_str<QByteArray> contents = binary.fileContents(); QTC_CHECK(contents); raw = contents.value_or(QByteArray()); diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index 5bfa0a9b0e8..32118cd56a4 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -234,7 +234,7 @@ FilePath FilePath::currentWorkingPath() bool FilePath::isRootPath() const { - if (needsDevice()) { + if (!isLocal()) { QStringView path = pathView(); if (osType() != OsTypeWindows) return path == QLatin1String("/"); @@ -262,7 +262,7 @@ bool FilePath::isResourceFile() const { if (scheme() == u"qrc") return true; - if (needsDevice()) + if (!isLocal()) return false; return pathView().startsWith(':'); } @@ -297,7 +297,7 @@ QString decodeHost(QString host) */ QString FilePath::toString() const { - if (!needsDevice()) + if (isLocal()) return path(); if (pathView().isEmpty()) @@ -377,7 +377,7 @@ QString FilePath::toFSPathString() const QUrl FilePath::toUrl() const { - if (!needsDevice()) + if (isLocal()) return QUrl::fromLocalFile(toFSPathString()); QUrl url; url.setScheme(scheme().toString()); @@ -395,7 +395,7 @@ QUrl FilePath::toUrl() const QString FilePath::toUserOutput() const { QString tmp = toString(); - if (needsDevice()) + if (!isLocal()) return tmp; if (osType() == OsTypeWindows) @@ -598,7 +598,7 @@ std::optional<FilePath> FilePath::refersToExecutableFile(MatchScope matchScope) expected_str<FilePath> FilePath::tmpDir() const { - if (needsDevice()) { + if (!isLocal()) { const expected_str<Environment> env = deviceEnvironmentWithError(); if (!env) return make_unexpected(env.error()); @@ -621,7 +621,7 @@ expected_str<FilePath> FilePath::tmpDir() const expected_str<FilePath> FilePath::createTempFile() const { - if (!needsDevice()) { + if (isLocal()) { QTemporaryFile file(path()); file.setAutoRemove(false); if (file.open()) @@ -726,13 +726,11 @@ expected_str<QByteArray> FilePath::fileContents(qint64 maxSize, qint64 offset) c bool FilePath::ensureReachable(const FilePath &other) const { - if (needsDevice()) { + if (!isLocal()) { QTC_ASSERT(deviceFileHooks().ensureReachable, return false); return deviceFileHooks().ensureReachable(*this, other); - } else if (!other.needsDevice()) { - return true; } - return false; + return other.isLocal(); } expected_str<qint64> FilePath::writeFileContents(const QByteArray &data) const @@ -757,16 +755,16 @@ FileStreamHandle FilePath::asyncWrite(const QByteArray &data, QObject *context, return FileStreamerManager::write(*this, data, context, cont); } -bool FilePath::needsDevice() const +bool FilePath::isLocal() const { - return m_schemeLen > 0 && scheme() != u"file"; + return m_schemeLen == 0 || scheme() == u"file"; } bool FilePath::isSameDevice(const FilePath &other) const { - if (needsDevice() != other.needsDevice()) + if (isLocal() != other.isLocal()) return false; - if (!needsDevice() && !other.needsDevice()) + if (isLocal() && other.isLocal()) return true; QTC_ASSERT(deviceFileHooks().isSameDevice, return true); @@ -1084,7 +1082,7 @@ FilePath FilePath::parentDir() const FilePath FilePath::absolutePath() const { - if (!needsDevice() && isEmpty()) + if (!!isLocal() && isEmpty()) return *this; const FilePath parentPath = isAbsolutePath() ? parentDir() @@ -1096,7 +1094,7 @@ FilePath FilePath::absoluteFilePath() const { if (isAbsolutePath()) return cleanPath(); - if (!needsDevice() && isEmpty()) + if (!!isLocal() && isEmpty()) return cleanPath(); return FilePath::currentWorkingPath().resolvePath(*this); @@ -1129,7 +1127,7 @@ const QString &FilePath::specialDeviceRootPath() FilePath FilePath::normalizedPathName() const { FilePath result = *this; - if (!needsDevice()) // FIXME: Assumes no remote Windows and Mac for now. + if (!!isLocal()) // FIXME: Assumes no remote Windows and Mac for now. result.setParts(scheme(), host(), FileUtils::normalizedPathName(path())); return result; } @@ -1146,7 +1144,7 @@ FilePath FilePath::normalizedPathName() const QString FilePath::displayName(const QString &args) const { QString deviceName; - if (needsDevice()) { + if (!isLocal()) { QTC_ASSERT(deviceFileHooks().deviceDisplayName, return nativePath()); deviceName = deviceFileHooks().deviceDisplayName(*this); } @@ -1278,7 +1276,7 @@ void FilePath::setFromString(QStringView fileNameView) static expected_str<DeviceFileAccess *> getFileAccess(const FilePath &filePath) { - if (!filePath.needsDevice()) + if (filePath.isLocal()) return DesktopDeviceFileAccess::instance(); if (!deviceFileHooks().fileAccess) { @@ -1890,7 +1888,7 @@ Environment FilePath::deviceEnvironment() const expected_str<Environment> FilePath::deviceEnvironmentWithError() const { - if (needsDevice()) { + if (!isLocal()) { QTC_ASSERT(deviceFileHooks().environment, return {}); return deviceFileHooks().environment(*this); } @@ -1900,7 +1898,7 @@ expected_str<Environment> FilePath::deviceEnvironmentWithError() const FilePaths FilePath::devicePathEnvironmentVariable() const { FilePaths result = deviceEnvironment().path(); - if (needsDevice()) { + if (!isLocal()) { for (FilePath &dir : result) dir.setParts(this->scheme(), this->host(), dir.path()); } @@ -2001,7 +1999,7 @@ bool FilePath::setPermissions(QFile::Permissions permissions) const OsType FilePath::osType() const { - if (!needsDevice()) + if (!!isLocal()) return HostOsInfo::hostOs(); QTC_ASSERT(deviceFileHooks().osType, return HostOsInfo::hostOs()); @@ -2200,7 +2198,7 @@ FilePath FilePath::resolveSymlinks() const */ FilePath FilePath::canonicalPath() const { - if (needsDevice()) { + if (!isLocal()) { // FIXME: Not a full solution, but it stays on the right device. return *this; } @@ -2330,7 +2328,7 @@ FilePath FilePath::resolvePath(const QString &tail) const expected_str<FilePath> FilePath::localSource() const { - if (!needsDevice()) + if (!!isLocal()) return *this; QTC_ASSERT(deviceFileHooks().localSource, @@ -2367,7 +2365,7 @@ QString FilePath::withTildeHomePath() const if (osType() == OsTypeWindows) return toString(); - if (needsDevice()) + if (!isLocal()) return toString(); static const QString homePath = QDir::homePath(); @@ -2486,8 +2484,8 @@ QTCREATOR_UTILS_EXPORT bool operator!=(const FilePath &first, const FilePath &se QTCREATOR_UTILS_EXPORT bool operator<(const FilePath &first, const FilePath &second) { - const bool firstNeedsDevice = first.needsDevice(); - const bool secondNeedsDevice = second.needsDevice(); + const bool firstNeedsDevice = !first.isLocal(); + const bool secondNeedsDevice = !second.isLocal(); // If either needs a device, we have to compare host and scheme first. if (firstNeedsDevice || secondNeedsDevice) { diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index 07bd00b9d81..35694346082 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -281,11 +281,12 @@ public: const WriteContinuation &cont = {}) const; // Prefer not to use - // Using needsDevice() in "user" code is likely to result in code that + // Using isLocal() in "user" code is likely to result in code that // makes a local/remote distinction which should be avoided in general. // There are usually other means available. E.g. distinguishing based // on FilePath::osType(). - bool needsDevice() const; + bool isLocal() const; + [[deprecated]] bool needsDevice() const { return !isLocal(); } bool hasFileAccess() const; bool isSameDevice(const FilePath &other) const; diff --git a/src/libs/utils/filestreamer.cpp b/src/libs/utils/filestreamer.cpp index 663f505b881..9079081e9ef 100644 --- a/src/libs/utils/filestreamer.cpp +++ b/src/libs/utils/filestreamer.cpp @@ -36,7 +36,7 @@ public: void setFilePath(const FilePath &filePath) { m_filePath = filePath; } void start() { QTC_ASSERT(!m_taskTreeRunner.isRunning(), return); - m_taskTreeRunner.start({m_filePath.needsDevice() ? remoteTask() : localTask()}); + m_taskTreeRunner.start({m_filePath.isLocal() ? localTask() : remoteTask()}); } signals: @@ -307,8 +307,8 @@ using FileStreamWriterTask = CustomTask<FileStreamWriterAdapter>; static Group sameRemoteDeviceTransferTask(const FilePath &source, const FilePath &destination) { - QTC_CHECK(source.needsDevice()); - QTC_CHECK(destination.needsDevice()); + QTC_CHECK(!source.isLocal()); + QTC_CHECK(!destination.isLocal()); QTC_CHECK(source.isSameDevice(destination)); const auto setup = [source, destination](Process &process) { @@ -359,7 +359,7 @@ static Group interDeviceTransferTask(const FilePath &source, const FilePath &des static Group transferTask(const FilePath &source, const FilePath &destination) { - if (source.needsDevice() && destination.needsDevice() && source.isSameDevice(destination)) + if (!source.isLocal() && !destination.isLocal() && source.isSameDevice(destination)) return sameRemoteDeviceTransferTask(source, destination); return interDeviceTransferTask(source, destination); } diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp index a713292c142..e20ebb853d6 100644 --- a/src/libs/utils/fileutils.cpp +++ b/src/libs/utils/fileutils.cpp @@ -282,7 +282,7 @@ void TempFileSaver::initFromString(const QString &templ) TempFileSaver::TempFileSaver(const FilePath &templ) { - if (templ.isEmpty() || !templ.needsDevice()) { + if (templ.isEmpty() || templ.isLocal()) { initFromString(templ.path()); } else { expected_str<FilePath> result = templ.createTempFile(); @@ -437,7 +437,7 @@ static QUrl filePathToQUrl(const FilePath &filePath) static void prepareNonNativeDialog(QFileDialog &dialog) { const auto isValidSideBarPath = [](const FilePath &fp) { - return !fp.needsDevice() || fp.hasFileAccess(); + return fp.isLocal() || fp.hasFileAccess(); }; // Checking QFileDialog::itemDelegate() seems to be the only way to determine @@ -524,7 +524,7 @@ FilePath getOpenFilePath(QWidget *parent, bool fromDeviceIfShiftIsPressed, bool forceNonNativeDialog) { - forceNonNativeDialog = forceNonNativeDialog || dir.needsDevice(); + forceNonNativeDialog = forceNonNativeDialog || !dir.isLocal(); #ifdef QT_GUI_LIB if (fromDeviceIfShiftIsPressed && qApp->queryKeyboardModifiers() & Qt::ShiftModifier) { forceNonNativeDialog = true; @@ -552,7 +552,7 @@ FilePath getSaveFilePath(QWidget *parent, QFileDialog::Options options, bool forceNonNativeDialog) { - forceNonNativeDialog = forceNonNativeDialog || dir.needsDevice(); + forceNonNativeDialog = forceNonNativeDialog || !dir.isLocal(); const QStringList schemes = QStringList(QStringLiteral("file")); return firstOrEmpty(getFilePaths(dialogParent(parent), @@ -574,7 +574,7 @@ FilePath getExistingDirectory(QWidget *parent, bool fromDeviceIfShiftIsPressed, bool forceNonNativeDialog) { - forceNonNativeDialog = forceNonNativeDialog || dir.needsDevice(); + forceNonNativeDialog = forceNonNativeDialog || !dir.isLocal(); #ifdef QT_GUI_LIB if (fromDeviceIfShiftIsPressed && qApp->queryKeyboardModifiers() & Qt::ShiftModifier) { @@ -602,7 +602,7 @@ FilePaths getOpenFilePaths(QWidget *parent, QString *selectedFilter, QFileDialog::Options options) { - bool forceNonNativeDialog = dir.needsDevice(); + bool forceNonNativeDialog = !dir.isLocal(); const QStringList schemes = QStringList(QStringLiteral("file")); return getFilePaths(dialogParent(parent), @@ -749,7 +749,7 @@ Result copyIfDifferent(const FilePath &srcFilePath, const FilePath &tgtFilePath) if (!srcFilePath.exists()) return Result::Error(Tr::tr("File %1 does not exist.").arg(srcFilePath.toUserOutput())); - if (srcFilePath.needsDevice() || tgtFilePath.needsDevice()) + if (!srcFilePath.isLocal() || !tgtFilePath.isLocal()) return srcFilePath.copyFile(tgtFilePath); if (tgtFilePath.exists()) { diff --git a/src/libs/utils/fsengine/fileiconprovider.cpp b/src/libs/utils/fsengine/fileiconprovider.cpp index 9d2a7c8c050..70d7c8b08b2 100644 --- a/src/libs/utils/fsengine/fileiconprovider.cpp +++ b/src/libs/utils/fsengine/fileiconprovider.cpp @@ -164,7 +164,7 @@ QIcon FileIconProviderImplementation::icon(IconType type) const QString FileIconProviderImplementation::type(const QFileInfo &fi) const { const FilePath fPath = FilePath::fromString(fi.filePath()); - if (fPath.needsDevice()) { + if (!fPath.isLocal()) { if (fi.isDir()) { #ifdef Q_OS_WIN return QGuiApplication::translate("QAbstractFileIconProvider", "File Folder", "Match Windows Explorer"); @@ -214,7 +214,7 @@ QIcon FileIconProviderImplementation::icon(const FilePath &filePath) const // Check if its one of the virtual devices directories if (filePath.path().startsWith(FilePath::specialRootPath())) { // If the filepath does not need a device, it is a virtual device directory - if (!filePath.needsDevice()) + if (filePath.isLocal()) return dirIcon(); } @@ -237,7 +237,7 @@ QIcon FileIconProviderImplementation::icon(const FilePath &filePath) const return *icon; } - if (filePath.needsDevice()) + if (!filePath.isLocal()) return isDir ? dirIcon() : unknownFileIcon(); // Get icon from OS (and cache it based on suffix!) diff --git a/src/libs/utils/fsengine/fsenginehandler.cpp b/src/libs/utils/fsengine/fsenginehandler.cpp index f48051bfe44..b9bd8bb810a 100644 --- a/src/libs/utils/fsengine/fsenginehandler.cpp +++ b/src/libs/utils/fsengine/fsenginehandler.cpp @@ -569,7 +569,7 @@ FSEngineHandler::create(const QString &fileName) const FilePath fixedPath = FilePath::fromString(fixedFileName); - if (fixedPath.needsDevice()) { + if (!fixedPath.isLocal()) { #if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0) return std::make_unique<FSEngineImpl>(removeDoubleSlash(fileName)); #else diff --git a/src/libs/utils/mimetypes2/mimeutils.cpp b/src/libs/utils/mimetypes2/mimeutils.cpp index 787353ceb24..9873a57d5fc 100644 --- a/src/libs/utils/mimetypes2/mimeutils.cpp +++ b/src/libs/utils/mimetypes2/mimeutils.cpp @@ -28,7 +28,7 @@ MimeType mimeTypeForFile(const QString &fileName, MimeMatchMode mode) MimeType mimeTypeForFile(const FilePath &filePath, MimeMatchMode mode) { MimeDatabase mdb; - if (filePath.needsDevice() && mode != MimeMatchMode::MatchDefaultAndRemote) + if (!filePath.isLocal() && mode != MimeMatchMode::MatchDefaultAndRemote) return mdb.mimeTypeForUrl(filePath.toUrl()); if (mode == MimeMatchMode::MatchDefaultAndRemote) { mode = MimeMatchMode::MatchDefault; diff --git a/src/libs/utils/pathchooser.cpp b/src/libs/utils/pathchooser.cpp index f268d4de2ca..73558995979 100644 --- a/src/libs/utils/pathchooser.cpp +++ b/src/libs/utils/pathchooser.cpp @@ -233,7 +233,7 @@ FilePath PathChooserPrivate::expandedPath(const FilePath &input) const // as 'cD:\\dev\\build-project' is considered is handled as being relative // input = "cD:\\dev\build-project"; // prepended 'c' to change the device letter // m_baseDirectory = "D:\\dev\\project" - if (!fp.needsDevice() && HostOsInfo::isWindowsHost() && fp.toString().count(':') > 1) + if (fp.isLocal() && HostOsInfo::isWindowsHost() && fp.toString().count(':') > 1) return path; return fp; } @@ -401,7 +401,7 @@ void PathChooser::slotBrowse(bool remote) predefined.clear(); } - remote = remote || filePath().needsDevice(); + remote = remote || !filePath().isLocal(); // Prompt for a file/dir FilePath newPath; diff --git a/src/libs/utils/processinfo.cpp b/src/libs/utils/processinfo.cpp index 89f732295c6..8139eba32f0 100644 --- a/src/libs/utils/processinfo.cpp +++ b/src/libs/utils/processinfo.cpp @@ -201,7 +201,7 @@ QList<ProcessInfo> ProcessInfo::processInfoList(const FilePath &deviceRoot) QList<ProcessInfo> ProcessInfo::processInfoList(const FilePath &deviceRoot) { - if (deviceRoot.needsDevice()) + if (!deviceRoot.isLocal()) return processInfoListUnix(deviceRoot); QList<ProcessInfo> processes; diff --git a/src/libs/utils/qtcprocess.cpp b/src/libs/utils/qtcprocess.cpp index 4799e8adbd0..ea27cab3f2c 100644 --- a/src/libs/utils/qtcprocess.cpp +++ b/src/libs/utils/qtcprocess.cpp @@ -1087,7 +1087,7 @@ const Environment &Process::controlEnvironment() const void Process::setRunData(const ProcessRunData &data) { - if (data.workingDirectory.needsDevice() && data.command.executable().needsDevice()) { + if (!data.workingDirectory.isLocal() && !data.command.executable().isLocal()) { QTC_CHECK(data.workingDirectory.isSameDevice(data.command.executable())); } d->m_setup.m_commandLine = data.command; @@ -1102,7 +1102,7 @@ ProcessRunData Process::runData() const void Process::setCommand(const CommandLine &cmdLine) { - if (d->m_setup.m_workingDirectory.needsDevice() && cmdLine.executable().needsDevice()) { + if (!d->m_setup.m_workingDirectory.isLocal() && !cmdLine.executable().isLocal()) { QTC_CHECK(d->m_setup.m_workingDirectory.isSameDevice(cmdLine.executable())); } d->m_setup.m_commandLine = cmdLine; @@ -1120,7 +1120,7 @@ FilePath Process::workingDirectory() const void Process::setWorkingDirectory(const FilePath &dir) { - if (dir.needsDevice() && d->m_setup.m_commandLine.executable().needsDevice()) { + if (!dir.isLocal() && !d->m_setup.m_commandLine.executable().isLocal()) { QTC_CHECK(dir.isSameDevice(d->m_setup.m_commandLine.executable())); } d->m_setup.m_workingDirectory = dir; @@ -1139,11 +1139,11 @@ void Process::start() "lead to crash! Consider calling close() prior to direct restart.")); d->clearForRun(); ProcessInterface *processImpl = nullptr; - if (d->m_setup.m_commandLine.executable().needsDevice()) { + if (d->m_setup.m_commandLine.executable().isLocal()) { + processImpl = d->createProcessInterface(); + } else { QTC_ASSERT(s_deviceHooks.processImplHook, return); processImpl = s_deviceHooks.processImplHook(commandLine().executable()); - } else { - processImpl = d->createProcessInterface(); } if (!processImpl) { diff --git a/src/libs/utils/savefile.cpp b/src/libs/utils/savefile.cpp index 9ccdf1cea52..49bc4e40560 100644 --- a/src/libs/utils/savefile.cpp +++ b/src/libs/utils/savefile.cpp @@ -130,7 +130,7 @@ bool SaveFile::commit() if constexpr (HostOsInfo::isWindowsHost()) { static const bool disableWinSpecialCode = !qEnvironmentVariableIsEmpty( "QTC_DISABLE_SPECIAL_WIN_SAVEFILE"); - if (!m_finalFilePath.needsDevice() && !disableWinSpecialCode) { + if (m_finalFilePath.isLocal() && !disableWinSpecialCode) { // Release the file lock m_tempFile.reset(); bool result = ReplaceFile( diff --git a/src/libs/utils/winutils.cpp b/src/libs/utils/winutils.cpp index ce896aa4bd8..6cff39f57c7 100644 --- a/src/libs/utils/winutils.cpp +++ b/src/libs/utils/winutils.cpp @@ -132,7 +132,7 @@ QTCREATOR_UTILS_EXPORT bool is64BitWindowsSystem() QTCREATOR_UTILS_EXPORT bool is64BitWindowsBinary(const FilePath &binaryIn) { - QTC_ASSERT(!binaryIn.isEmpty() && !binaryIn.needsDevice(), return false); + QTC_ASSERT(!binaryIn.isEmpty() && binaryIn.isLocal(), return false); #ifdef Q_OS_WIN32 # ifdef __GNUC__ // MinGW lacking some definitions/winbase.h # define SCS_64BIT_BINARY 6 diff --git a/src/plugins/axivion/axivionsettings.cpp b/src/plugins/axivion/axivionsettings.cpp index 834d2602cd0..b29423c844e 100644 --- a/src/plugins/axivion/axivionsettings.cpp +++ b/src/plugins/axivion/axivionsettings.cpp @@ -90,7 +90,7 @@ static bool analysisPathValid(const FilePath &analysisPath, QString *error) { if (analysisPath.isEmpty()) return true; - if (analysisPath.needsDevice() || analysisPath.isAbsolutePath()) { + if (!analysisPath.isLocal() || analysisPath.isAbsolutePath()) { if (error) *error = QString("Path must be relative."); return false; @@ -107,7 +107,7 @@ static bool analysisPathValid(const FilePath &analysisPath, QString *error) bool PathMapping::isValid() const { return !projectName.isEmpty() && !localPath.isEmpty() - && !localPath.needsDevice() && localPath.isAbsolutePath() + && localPath.isLocal() && localPath.isAbsolutePath() && analysisPathValid(analysisPath, nullptr); } diff --git a/src/plugins/beautifier/beautifiertool.cpp b/src/plugins/beautifier/beautifiertool.cpp index 9e55cf18363..8160c6289a9 100644 --- a/src/plugins/beautifier/beautifiertool.cpp +++ b/src/plugins/beautifier/beautifiertool.cpp @@ -302,7 +302,7 @@ void AbstractSettings::save() FilePath filePath = styleFileName(key); filePath.removeFile(); QTC_ASSERT(m_styleDir.isAbsolutePath(), break); - QTC_ASSERT(!m_styleDir.needsDevice(), break); + QTC_ASSERT(m_styleDir.isLocal(), break); const FilePath parentDir = filePath.parentDir(); if (parentDir != m_styleDir) { // FIXME: Missing in FilePath diff --git a/src/plugins/clangformat/llvmfilesystem.h b/src/plugins/clangformat/llvmfilesystem.h index b2d1c5de7e7..57b375c5900 100644 --- a/src/plugins/clangformat/llvmfilesystem.h +++ b/src/plugins/clangformat/llvmfilesystem.h @@ -144,7 +144,7 @@ public: std::error_code isLocal(const Twine &Path, bool &Result) override { const FilePath filePath = FilePath::fromString(QString::fromStdString(Path.str())); - Result = !filePath.needsDevice(); + Result = filePath.isLocal(); return {}; } diff --git a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp index 786a5e9493e..80b249620b9 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp @@ -2152,7 +2152,7 @@ void CMakeBuildConfiguration::addToEnvironment(Utils::Environment &env) const const CMakeTool *tool = CMakeKitAspect::cmakeTool(kit()); // The hack further down is only relevant for desktop - if (tool && tool->cmakeExecutable().needsDevice()) + if (tool && !tool->cmakeExecutable().isLocal()) return; const FilePath ninja = settings(nullptr).ninjaPath(); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp index c3bce2741cc..8f593089169 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp @@ -1948,7 +1948,7 @@ void CMakeBuildSystem::ensureBuildDirectory(const BuildDirParameters ¶meters return; } - if (tool->cmakeExecutable().needsDevice()) { + if (!tool->cmakeExecutable().isLocal()) { if (!tool->cmakeExecutable().ensureReachable(bdir)) { // Make sure that the build directory is available on the device. handleParsingFailed( diff --git a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp index ea5fdb11416..5130ab00ce6 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprocess.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprocess.cpp @@ -93,7 +93,7 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList & return; } - if (buildDirectory.needsDevice()) { + if (!buildDirectory.isLocal()) { if (!cmake->cmakeExecutable().isSameDevice(buildDirectory)) { const QString msg = ::CMakeProjectManager::Tr::tr( "CMake executable \"%1\" and build directory \"%2\" must be on the same device.") diff --git a/src/plugins/cmakeprojectmanager/cmaketool.cpp b/src/plugins/cmakeprojectmanager/cmaketool.cpp index 22712536c4f..75b9f981edd 100644 --- a/src/plugins/cmakeprojectmanager/cmaketool.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketool.cpp @@ -380,7 +380,7 @@ std::optional<CMakeTool::ReaderType> CMakeTool::readerType() const FilePath CMakeTool::searchQchFile(const FilePath &executable) { - if (executable.isEmpty() || executable.needsDevice()) // do not register docs from devices + if (executable.isEmpty() || !executable.isLocal()) // do not register docs from devices return {}; FilePath prefixDir = executable.parentDir().parentDir(); diff --git a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp index 113021b3d7f..ab188b307e2 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolmanager.cpp @@ -441,7 +441,7 @@ FilePath CMakeToolManager::mappedFilePath(Project *project, const FilePath &path if (!HostOsInfo::isWindowsHost()) return path; - if (path.needsDevice()) + if (!path.isLocal()) return path; auto environment = Environment::systemEnvironment(); @@ -560,7 +560,7 @@ void CMakeToolManager::ensureDefaultCMakeToolIsValid() if (findById(d->m_defaultCMake)) return; auto cmakeTool = Utils::findOrDefault(cmakeTools(), [](CMakeTool *tool) { - return tool->detectionSource().isEmpty() && !tool->cmakeExecutable().needsDevice(); + return tool->detectionSource().isEmpty() && tool->cmakeExecutable().isLocal(); }); if (cmakeTool) d->m_defaultCMake = cmakeTool->id(); diff --git a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp index e8e5a8a64ea..3b3a5e57d3c 100644 --- a/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp +++ b/src/plugins/cmakeprojectmanager/cmaketoolsettingsaccessor.cpp @@ -176,7 +176,7 @@ void CMakeToolSettingsAccessor::saveCMakeTools(const QList<CMakeTool *> &cmakeTo int count = 0; for (CMakeTool *item : cmakeTools) { Utils::FilePath fi = item->cmakeExecutable(); - if (fi.needsDevice() || fi.isExecutableFile()) { // be graceful for device related stuff + if (!fi.isLocal() || fi.isExecutableFile()) { // be graceful for device related stuff Store tmp = item->toMap(); if (tmp.isEmpty()) continue; @@ -203,7 +203,7 @@ CMakeToolSettingsAccessor::cmakeTools(const Store &data, bool fromSdk) const const Store dbMap = storeFromVariant(data.value(key)); auto item = std::make_unique<CMakeTool>(dbMap, fromSdk); const FilePath cmakeExecutable = item->cmakeExecutable(); - if (item->isAutoDetected() && !cmakeExecutable.needsDevice() && !cmakeExecutable.isExecutableFile()) { + if (item->isAutoDetected() && cmakeExecutable.isLocal() && !cmakeExecutable.isExecutableFile()) { qWarning() << QString("CMakeTool \"%1\" (%2) dropped since the command is not executable.") .arg(cmakeExecutable.toUserOutput(), item->id().toString()); continue; diff --git a/src/plugins/cmakeprojectmanager/fileapireader.cpp b/src/plugins/cmakeprojectmanager/fileapireader.cpp index bcfb12e13c4..c109fece0b8 100644 --- a/src/plugins/cmakeprojectmanager/fileapireader.cpp +++ b/src/plugins/cmakeprojectmanager/fileapireader.cpp @@ -421,7 +421,7 @@ void FileApiReader::replyDirectoryHasChanged(const QString &directory) const const FilePath dir = reply.absolutePath(); if (dir.isEmpty()) return; // CMake started to fill the result dir, but has not written a result file yet - QTC_CHECK(!dir.needsDevice()); + QTC_CHECK(dir.isLocal()); QTC_ASSERT(dir.path() == directory, return); if (m_lastReplyTimestamp.isValid() && reply.lastModified() > m_lastReplyTimestamp) diff --git a/src/plugins/coreplugin/locator/filesystemfilter.cpp b/src/plugins/coreplugin/locator/filesystemfilter.cpp index 2bc451dcf70..3213d32504b 100644 --- a/src/plugins/coreplugin/locator/filesystemfilter.cpp +++ b/src/plugins/coreplugin/locator/filesystemfilter.cpp @@ -141,7 +141,7 @@ static void matches(QPromise<void> &promise, const LocatorStorage &storage, ? expandedEntryPath : currentDocumentDir.resolvePath(expandedEntryPath); // The case of e.g. "ssh://", "ssh://*p", etc - const bool isPartOfDeviceRoot = expandedEntryPath.needsDevice() + const bool isPartOfDeviceRoot = !expandedEntryPath.isLocal() && expandedEntryPath.path().isEmpty(); // Consider the entered path a directory if it ends with slash/backslash. diff --git a/src/plugins/debugger/dap/pydapengine.cpp b/src/plugins/debugger/dap/pydapengine.cpp index 666750b3e66..43a58bac9b1 100644 --- a/src/plugins/debugger/dap/pydapengine.cpp +++ b/src/plugins/debugger/dap/pydapengine.cpp @@ -40,8 +40,8 @@ const char installDebugPyInfoBarId[] = "Python::InstallDebugPy"; static FilePath packageDir(const FilePath &python, const QString &packageName) { - expected_str<FilePath> baseDir = python.needsDevice() ? python.tmpDir() - : Core::ICore::userResourcePath(); + expected_str<FilePath> baseDir = python.isLocal() ? Core::ICore::userResourcePath() + : python.tmpDir(); return baseDir ? baseDir->pathAppended(packageName) : FilePath(); } @@ -243,7 +243,7 @@ void PyDapEngine::setupEngine() "pip", "install", "-t", - target.needsDevice() ? target.path() : target.toUserOutput(), + target.isLocal() ? target.toUserOutput() : target.path(), "debugpy", "--upgrade"}}); m_installProcess->setTerminalMode(TerminalMode::Run); diff --git a/src/plugins/debugger/debuggeritemmanager.cpp b/src/plugins/debugger/debuggeritemmanager.cpp index 94f5a6199f5..6a162757bb3 100644 --- a/src/plugins/debugger/debuggeritemmanager.cpp +++ b/src/plugins/debugger/debuggeritemmanager.cpp @@ -629,7 +629,7 @@ void DebuggerItemModel::autoDetectGdbOrLldbDebuggers(const FilePaths &searchPath } FilePaths paths = searchPaths; - if (!searchPaths.front().needsDevice()) { + if (searchPaths.front().isLocal()) { paths.append(searchGdbPathsFromRegistry()); const expected_str<FilePath> lldb = Core::ICore::lldbExecutable(CLANG_BINDIR); @@ -777,7 +777,7 @@ void DebuggerItemModel::readDebuggers(const FilePath &fileName, bool isSystem) continue; } // FIXME: During startup, devices are not yet available, so we cannot check if the file still exists. - if (!item.command().needsDevice() && !item.command().isExecutableFile()) { + if (item.command().isLocal() && !item.command().isExecutableFile()) { qWarning() << QString("DebuggerItem \"%1\" (%2) read from \"%3\" dropped since the command is not executable.") .arg(item.command().toUserOutput(), item.id().toString(), fileName.toUserOutput()); continue; diff --git a/src/plugins/debugger/debuggerkitaspect.cpp b/src/plugins/debugger/debuggerkitaspect.cpp index 946f1e1ca3e..40294f56986 100644 --- a/src/plugins/debugger/debuggerkitaspect.cpp +++ b/src/plugins/debugger/debuggerkitaspect.cpp @@ -285,7 +285,7 @@ public: // This improves the situation a bit if a cross-compilation tool chain has the // same ABI as the host. if (level == DebuggerItem::MatchesPerfectly - && !item.command().needsDevice() + && item.command().isLocal() && systemEnvironment.path().contains(item.command().parentDir())) { level = DebuggerItem::MatchesPerfectlyInPath; } diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index d8bfdfb2a6a..a3b16abdd60 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -3999,7 +3999,7 @@ void GdbEngine::handleGdbStarted() // runCommand({"set inferior-tty " + QString::fromUtf8(terminal()->slaveDevice())}); const FilePath dumperPath = ICore::resourcePath("debugger"); - if (rp.debugger.command.executable().needsDevice()) { + if (!rp.debugger.command.executable().isLocal()) { // Gdb itself running remotely. const FilePath loadOrderFile = dumperPath / "loadorder.txt"; const expected_str<QByteArray> toLoad = loadOrderFile.fileContents(); @@ -4411,7 +4411,7 @@ bool GdbEngine::isTermEngine() const bool GdbEngine::usesOutputCollector() const { - return isPlainEngine() && !runParameters().debugger.command.executable().needsDevice(); + return isPlainEngine() && runParameters().debugger.command.executable().isLocal(); } void GdbEngine::claimInitialBreakpoints() @@ -4740,7 +4740,7 @@ void GdbEngine::interruptInferior2() interruptLocalInferior(runParameters().attachPID.pid()); } else if (isRemoteEngine() || runParameters().startMode == AttachToRemoteProcess - || m_gdbProc.commandLine().executable().needsDevice()) { + || !m_gdbProc.commandLine().executable().isLocal()) { CHECK_STATE(InferiorStopRequested); if (usesTargetAsync()) { diff --git a/src/plugins/debugger/moduleshandler.cpp b/src/plugins/debugger/moduleshandler.cpp index 3d72f704576..a6b10b59ffe 100644 --- a/src/plugins/debugger/moduleshandler.cpp +++ b/src/plugins/debugger/moduleshandler.cpp @@ -171,7 +171,7 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev) addAction(this, menu, Tr::tr("Show Dependencies of \"%1\"").arg(moduleName), Tr::tr("Show Dependencies"), - moduleNameValid && !modulePath.needsDevice() && modulePath.exists() + moduleNameValid && modulePath.isLocal() && modulePath.exists() && dependsCanBeFound(), [modulePath] { Process::startDetached({{"depends"}, {modulePath.toString()}}); diff --git a/src/plugins/docker/dockerdevice.cpp b/src/plugins/docker/dockerdevice.cpp index 8f6e839ba35..73f8c59da6b 100644 --- a/src/plugins/docker/dockerdevice.cpp +++ b/src/plugins/docker/dockerdevice.cpp @@ -215,7 +215,7 @@ public: { if (q->clangdExecutableAspect().isEmpty()) return std::nullopt; - if (!q->clangdExecutableAspect().needsDevice()) + if (q->clangdExecutableAspect().isLocal()) return q->rootPath().withNewMappedPath(q->clangdExecutableAspect()); return q->clangdExecutableAspect(); } @@ -611,7 +611,7 @@ DockerDevice::DockerDevice() return asyncRun([rootPath, newValue]() -> expected_str<QString> { QString changedValue = newValue; FilePath path = FilePath::fromUserInput(newValue); - if (!path.needsDevice()) { + if (path.isLocal()) { const FilePath onDevicePath = rootPath.withNewMappedPath(path); if (onDevicePath.exists()) { changedValue = onDevicePath.toUserOutput(); @@ -827,7 +827,7 @@ QStringList toMountArg(const DockerDevicePrivate::MountPair &mi) expected_str<void> isValidMountInfo(const DockerDevicePrivate::MountPair &mi) { - if (mi.path.needsDevice()) + if (!mi.path.isLocal()) return make_unexpected(QString("The path \"%1\" is not local.").arg(mi.path.toUserOutput())); if (mi.path.isEmpty() && mi.containerPath.isEmpty()) @@ -1105,7 +1105,7 @@ bool DockerDevice::ensureReachable(const FilePath &other) const if (other.isSameDevice(rootPath())) return true; - if (other.needsDevice()) + if (!other.isLocal()) return false; if (other.isDir()) diff --git a/src/plugins/docker/dockerdevice.h b/src/plugins/docker/dockerdevice.h index b738ac41b05..0f929bdaf6c 100644 --- a/src/plugins/docker/dockerdevice.h +++ b/src/plugins/docker/dockerdevice.h @@ -41,7 +41,7 @@ public: bool canMount(const Utils::FilePath &filePath) const override { - return !filePath.needsDevice() || filePath.isSameDevice(rootPath()); + return filePath.isLocal() || filePath.isSameDevice(rootPath()); } bool handlesFile(const Utils::FilePath &filePath) const override; diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 6bb1301f40b..1e8b5c05bbf 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2629,7 +2629,7 @@ bool GitClient::launchGitBash(const FilePath &workingDirectory) FilePath GitClient::vcsBinary(const FilePath &forDirectory) const { - if (forDirectory.needsDevice()) { + if (!forDirectory.isLocal()) { auto it = m_gitExecutableCache.find(forDirectory.withNewPath({})); if (it == m_gitExecutableCache.end()) { const FilePath gitBin = forDirectory.withNewPath("git").searchInPath(); diff --git a/src/plugins/projectexplorer/buildaspects.cpp b/src/plugins/projectexplorer/buildaspects.cpp index dfaf86205dd..ae8eeb83b78 100644 --- a/src/plugins/projectexplorer/buildaspects.cpp +++ b/src/plugins/projectexplorer/buildaspects.cpp @@ -159,7 +159,7 @@ void BuildDirectoryAspect::addToLayoutImpl(Layouting::Layout &parent) FilePath BuildDirectoryAspect::fixupDir(const FilePath &dir) { - if (dir.needsDevice()) + if (!dir.isLocal()) return dir; if (HostOsInfo::isWindowsHost() && !dir.startsWithDriveLetter()) return {}; diff --git a/src/plugins/projectexplorer/desktoprunconfiguration.cpp b/src/plugins/projectexplorer/desktoprunconfiguration.cpp index 3cbe11125b9..3582dad2bf8 100644 --- a/src/plugins/projectexplorer/desktoprunconfiguration.cpp +++ b/src/plugins/projectexplorer/desktoprunconfiguration.cpp @@ -100,8 +100,8 @@ void DesktopRunConfiguration::updateTargetInformation() BuildTargetInfo bti = buildTargetInfo(); auto terminalAspect = aspect<TerminalAspect>(); - terminalAspect->setUseTerminalHint(bti.targetFilePath.needsDevice() ? false : bti.usesTerminal); - terminalAspect->setEnabled(!bti.targetFilePath.needsDevice()); + terminalAspect->setUseTerminalHint(!bti.targetFilePath.isLocal() ? false : bti.usesTerminal); + terminalAspect->setEnabled(bti.targetFilePath.isLocal()); auto launcherAspect = aspect<LauncherAspect>(); launcherAspect->setVisible(false); diff --git a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp index b055cb399a4..b1299403486 100644 --- a/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp +++ b/src/plugins/projectexplorer/devicesupport/desktopdevice.cpp @@ -105,7 +105,7 @@ QUrl DesktopDevice::toolControlChannel(const ControlChannelHint &) const bool DesktopDevice::handlesFile(const FilePath &filePath) const { - return !filePath.needsDevice(); + return filePath.isLocal(); } FilePath DesktopDevice::filePath(const QString &pathOnDevice) const diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp index 4af922fae0a..cad72ceaf3e 100644 --- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp +++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp @@ -417,7 +417,7 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManager }; deviceHooks.fileAccess = [](const FilePath &filePath) -> expected_str<DeviceFileAccess *> { - if (!filePath.needsDevice()) + if (filePath.isLocal()) return DesktopDeviceFileAccess::instance(); IDevice::ConstPtr device = DeviceManager::deviceForPath(filePath); if (!device) { diff --git a/src/plugins/projectexplorer/gcctoolchain.cpp b/src/plugins/projectexplorer/gcctoolchain.cpp index 9b4513e203b..c4dadedef01 100644 --- a/src/plugins/projectexplorer/gcctoolchain.cpp +++ b/src/plugins/projectexplorer/gcctoolchain.cpp @@ -1668,8 +1668,8 @@ Toolchains GccToolchainFactory::autoDetectToolchains(const FilePaths &compilerPa existingTcMatches = existingCommand.isSameExecutable(compilerPath); if (!existingTcMatches && HostOsInfo::isWindowsHost() - && !existingCommand.needsDevice() - && !compilerPath.needsDevice()) { + && existingCommand.isLocal() + && compilerPath.isLocal()) { existingTcMatches = existingCommand.fileSize() == compilerPath.fileSize(); } } diff --git a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp index 0d74f2fbf27..6cb79cef777 100644 --- a/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp +++ b/src/plugins/projectexplorer/jsonwizard/jsonwizardfactory.cpp @@ -600,9 +600,8 @@ FilePaths &JsonWizardFactory::searchPaths() const auto values = plugin->metaData().value("JsonWizardPaths").toArray(); for (const QJsonValue &v : values) { const auto path = FilePath::fromString(v.toString()); - if (!path.isEmpty() && !path.needsDevice()) { + if (!path.isEmpty() && path.isLocal()) m_searchPaths << base.resolvePath(path); - } } } } diff --git a/src/plugins/projectexplorer/processparameters.cpp b/src/plugins/projectexplorer/processparameters.cpp index 54a5dffcdb0..07d0a2788de 100644 --- a/src/plugins/projectexplorer/processparameters.cpp +++ b/src/plugins/projectexplorer/processparameters.cpp @@ -99,7 +99,7 @@ FilePath ProcessParameters::effectiveCommand() const FilePath cmd = m_runData.command.executable(); if (m_macroExpander) cmd = m_macroExpander->expand(cmd); - if (cmd.needsDevice()) { + if (!cmd.isLocal()) { // Assume this is already good. FIXME: It is possibly not, so better fix searchInPath. m_effectiveCommand = cmd; } else { diff --git a/src/plugins/projectexplorer/projectexplorer.cpp b/src/plugins/projectexplorer/projectexplorer.cpp index 437ba6b4101..f3451b92ca3 100644 --- a/src/plugins/projectexplorer/projectexplorer.cpp +++ b/src/plugins/projectexplorer/projectexplorer.cpp @@ -2234,7 +2234,7 @@ void ProjectExplorerPluginPrivate::checkRecentProjectsAsync() m_recentProjectsFuture = QtConcurrent::mapped(&m_recentProjectsPool, m_recentProjects, [](RecentProjectsEntry p) { // check if project is available, but avoid querying devices - p.exists = p.filePath.needsDevice() || p.filePath.exists(); + p.exists = !p.filePath.isLocal() || p.filePath.exists(); return p; }); Utils::futureSynchronizer()->addFuture(m_recentProjectsFuture); @@ -3845,10 +3845,10 @@ void ProjectExplorerPluginPrivate::openTerminalHere(const EnvironmentGetter &env return; } - if (buildDevice->rootPath().needsDevice()) - Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir, environment}); - else + if (buildDevice->rootPath().isLocal()) Terminal::Hooks::instance().openTerminal({workingDir, environment}); + else + Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir, environment}); } void ProjectExplorerPluginPrivate::openTerminalHereWithRunEnv() @@ -3885,11 +3885,11 @@ void ProjectExplorerPluginPrivate::openTerminalHereWithRunEnv() return; } - if (device->rootPath().needsDevice()) { + if (!device->rootPath().isLocal()) { + Terminal::Hooks::instance().openTerminal({workingDir, runnable.environment}); + } else { Terminal::Hooks::instance().openTerminal({CommandLine{*shell}, workingDir, runnable.environment}); - } else { - Terminal::Hooks::instance().openTerminal({workingDir, runnable.environment}); } } diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index 42e1d604741..414c123086c 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -375,7 +375,7 @@ FilePath Node::pathOrDirectory(bool dir) const if (m_filePath.isEmpty()) return {}; - if (m_filePath.needsDevice()) { + if (!m_filePath.isLocal()) { if (dir) return m_filePath.isDir() ? m_filePath.absoluteFilePath() : m_filePath.absolutePath(); return m_filePath; @@ -413,7 +413,7 @@ FileNode::FileNode(const Utils::FilePath &filePath, const FileType fileType) : setFilePath(filePath); const bool ignored = (fileType == FileType::Project || fileType == FileType::App || fileType == FileType::Lib); - setUseUnavailableMarker(!ignored && !filePath.needsDevice() && !filePath.exists()); + setUseUnavailableMarker(!ignored && filePath.isLocal() && !filePath.exists()); setListInProject(true); if (fileType == FileType::Project) setPriority(DefaultProjectFilePriority); diff --git a/src/plugins/projectexplorer/runcontrol.cpp b/src/plugins/projectexplorer/runcontrol.cpp index 666c734aab1..9a0893737c8 100644 --- a/src/plugins/projectexplorer/runcontrol.cpp +++ b/src/plugins/projectexplorer/runcontrol.cpp @@ -1436,7 +1436,7 @@ SimpleTargetRunnerPrivate::SimpleTargetRunnerPrivate(SimpleTargetRunner *parent) m_waitForDoneTimer.setSingleShot(true); connect(&m_waitForDoneTimer, &QTimer::timeout, this, [this] { q->appendMessage(Tr::tr("Process unexpectedly did not finish."), ErrorMessageFormat); - if (m_command.executable().needsDevice()) + if (!m_command.executable().isLocal()) q->appendMessage(Tr::tr("Connectivity lost?"), ErrorMessageFormat); m_process.close(); forwardDone(); @@ -1527,7 +1527,7 @@ void SimpleTargetRunnerPrivate::start() m_resultData = {}; QTC_ASSERT(m_state == Inactive, return); - if (!m_command.executable().needsDevice()) { + if (m_command.executable().isLocal()) { // Running locally. if (m_runAsRoot) RunControl::provideAskPassEntry(env); @@ -1609,7 +1609,7 @@ void SimpleTargetRunnerPrivate::forwardDone() void SimpleTargetRunnerPrivate::forwardStarted() { - const bool isDesktop = !m_command.executable().needsDevice(); + const bool isDesktop = m_command.executable().isLocal(); if (isDesktop) { // Console processes only know their pid after being started ProcessHandle pid{privateApplicationPID()}; @@ -1657,7 +1657,7 @@ void SimpleTargetRunner::start() appendMessage({}, StdOutFormat); } - const bool isDesktop = !d->m_command.executable().needsDevice(); + const bool isDesktop = d->m_command.executable().isLocal(); if (isDesktop && d->m_command.isEmpty()) { reportFailure(Tr::tr("No executable specified.")); return; @@ -1714,7 +1714,7 @@ void SimpleTargetRunner::suppressDefaultStdOutHandling() void SimpleTargetRunner::forceRunOnHost() { const FilePath executable = d->m_command.executable(); - if (executable.needsDevice()) { + if (!executable.isLocal()) { QTC_CHECK(false); d->m_command.setExecutable(FilePath::fromString(executable.path())); } diff --git a/src/plugins/projectexplorer/toolchainmanager.cpp b/src/plugins/projectexplorer/toolchainmanager.cpp index 8e59ec7a505..c7d7ce786cf 100644 --- a/src/plugins/projectexplorer/toolchainmanager.cpp +++ b/src/plugins/projectexplorer/toolchainmanager.cpp @@ -373,7 +373,7 @@ bool ToolchainManager::isBetterToolchain( // Hack to prefer a tool chain from PATH (e.g. autodetected) over other matches. // This improves the situation a bit if a cross-compilation tool chain has the // same ABI as the host. - if (!bundle1.get(&Toolchain::compilerCommand).needsDevice()) { + if (bundle1.get(&Toolchain::compilerCommand).isLocal()) { const FilePaths envPathVar = Environment::systemEnvironment().path(); const auto toolchainIsInPath = [&envPathVar](const ToolchainBundle &b) { return Utils::contains(b.toolchains(), [&envPathVar](const Toolchain *tc) { @@ -390,7 +390,7 @@ bool ToolchainManager::isBetterToolchain( } } - if (!path1.needsDevice() && !path2.needsDevice()) { + if (path1.isLocal() && path2.isLocal()) { const QVersionNumber v1 = bundle1.get(&Toolchain::version); const QVersionNumber v2 = bundle2.get(&Toolchain::version); if (!v1.isNull() && !v2.isNull()) { diff --git a/src/plugins/python/pythonkitaspect.cpp b/src/plugins/python/pythonkitaspect.cpp index 62bb10e5b00..548c99b1b13 100644 --- a/src/plugins/python/pythonkitaspect.cpp +++ b/src/plugins/python/pythonkitaspect.cpp @@ -92,7 +92,7 @@ public: if (!python) return result; const FilePath path = python->command; - if (path.needsDevice()) + if (!path.isLocal()) return result; if (path.isEmpty()) { result << BuildSystemTask(Task::Error, Tr::tr("No Python setup.")); diff --git a/src/plugins/python/pythonlanguageclient.cpp b/src/plugins/python/pythonlanguageclient.cpp index bbfb5c75474..ea92b20d451 100644 --- a/src/plugins/python/pythonlanguageclient.cpp +++ b/src/plugins/python/pythonlanguageclient.cpp @@ -70,7 +70,7 @@ static QHash<FilePath, PyLSClient*> &pythonClients() static FilePath pyLspPath(const FilePath &python) { const QString version = pythonVersion(python); - if (!python.needsDevice()) + if (python.isLocal()) return Core::ICore::userResourcePath() / "pylsp" / version; if (const expected_str<FilePath> tmpDir = python.tmpDir()) return *tmpDir / "qc-pylsp" / version; @@ -136,7 +136,7 @@ protected: if (!lspPath.isEmpty() && lspPath.exists() && QTC_GUARD(lspPath.isSameDevice(python))) { env.appendOrSet("PYTHONPATH", lspPath.path()); } - if (!python.needsDevice()) { + if (python.isLocal()) { // todo check where to put this tempdir in remote setups env.appendOrSet("PYTHONPATH", m_extraPythonPath.path().toString()); } diff --git a/src/plugins/python/pythonsettings.cpp b/src/plugins/python/pythonsettings.cpp index 58e5d11f81b..20eae05906b 100644 --- a/src/plugins/python/pythonsettings.cpp +++ b/src/plugins/python/pythonsettings.cpp @@ -287,7 +287,7 @@ void InterpreterOptionsWidget::updateCleanButton() void InterpreterOptionsWidget::updateGenerateKitButton(const Interpreter &interpreter) { bool enabled = !KitManager::kit(Id::fromString(interpreter.id)) - && (interpreter.command.needsDevice() || interpreter.command.isExecutableFile()); + && (!interpreter.command.isLocal() || interpreter.command.isExecutableFile()); m_generateKitButton->setEnabled(enabled); } @@ -806,7 +806,7 @@ void PythonSettings::removeKitsForInterpreter(const Interpreter &interpreter) bool PythonSettings::interpreterIsValid(const Interpreter &interpreter) { - return interpreter.command.needsDevice() || interpreter.command.isExecutableFile(); + return !interpreter.command.isLocal() || interpreter.command.isExecutableFile(); } void PythonSettings::setInterpreter(const QList<Interpreter> &interpreters, const QString &defaultId) @@ -1019,7 +1019,7 @@ void PythonSettings::initFromSettings(QtcSettings *settings) const auto keepInterpreter = [](const Interpreter &interpreter) { return !interpreter.autoDetected // always keep user added interpreters - || interpreter.command.needsDevice() // remote devices might not be reachable at startup + || !interpreter.command.isLocal() // remote devices might not be reachable at startup || interpreter.command.isExecutableFile(); }; @@ -1030,7 +1030,7 @@ void PythonSettings::initFromSettings(QtcSettings *settings) for (const Interpreter &interpreter : m_interpreters) { if (interpreter.autoDetected) { const FilePath &cmd = interpreter.command; - if (cmd.needsDevice() || cmd.parentDir().pathAppended("activate").exists()) + if (!cmd.isLocal() || cmd.parentDir().pathAppended("activate").exists()) continue; } addKitsForInterpreter(interpreter, false); @@ -1186,7 +1186,7 @@ Utils::ListModel<ProjectExplorer::Interpreter> *createInterpreterModel(QObject * return f; } case Qt::ToolTipRole: - if (interpreter.command.needsDevice()) + if (!interpreter.command.isLocal()) break; if (interpreter.command.isEmpty()) return Tr::tr("Executable is empty."); diff --git a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp index 5204334ecd7..6e804f70b30 100644 --- a/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeparsernodes.cpp @@ -144,7 +144,7 @@ FilePath QmakePriFile::directoryPath() const QString QmakePriFile::deviceRoot() const { - if (m_filePath.needsDevice()) + if (!m_filePath.isLocal()) return m_filePath.withNewPath("/").toFSPathString(); return {}; } diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index ffd219cd164..e3cb45c7673 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -813,7 +813,7 @@ FilePath QmakeBuildSystem::buildDir(const FilePath &proFilePath) const // the convoluted existing local version for now. // For starters, compute a 'new' version to check what it would look like, // but don't use it. - if (!proFilePath.needsDevice()) { + if (proFilePath.isLocal()) { // This branch should not exist. const QDir srcDirRoot = QDir(projectDirectory().toString()); const QString relativeDir = srcDirRoot.relativeFilePath(proFilePath.parentDir().toString()); @@ -1457,7 +1457,7 @@ QString QmakeBuildSystem::deviceRoot() const IDeviceConstPtr device = BuildDeviceKitAspect::device(target()->kit()); QTC_ASSERT(device, return {}); FilePath deviceRoot = device->rootPath(); - if (deviceRoot.needsDevice()) + if (!deviceRoot.isLocal()) return deviceRoot.toFSPathString(); return {}; diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 2e19566b983..1bbf74f96ad 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -275,7 +275,7 @@ QString QtVersion::defaultUnexpandedDisplayName() const ? Tr::tr("Qt %{Qt:Version} in PATH (%2)").arg(location) : Tr::tr("Qt %{Qt:Version} (%2)").arg(location); - if (qmakeFilePath().needsDevice()) + if (!qmakeFilePath().isLocal()) result += QString(Tr::tr(" (on %1)")).arg(qmakeFilePath().host().toString()); return result; @@ -631,7 +631,7 @@ void QtVersion::fromMap(const Store &map, const FilePath &filePath) if (string.startsWith('~')) string.remove(0, 1).prepend(QDir::homePath()); qmake = qmake.withNewPath(string); - if (!d->m_qmakeCommand.needsDevice()) { + if (d->m_qmakeCommand.isLocal()) { if (BuildableHelperLibrary::isQtChooser(qmake)) { // we don't want to treat qtchooser as a normal qmake // see e.g. QTCREATORBUG-9841, also this lead to users changing what @@ -1115,7 +1115,7 @@ void QtVersion::ensureMkSpecParsed() const Environment env = d->m_qmakeCommand.deviceEnvironment(); setupQmakeRunEnvironment(env); option.environment = env.toProcessEnvironment(); - if (d->m_qmakeCommand.needsDevice()) + if (!d->m_qmakeCommand.isLocal()) option.device_root = d->m_qmakeCommand.withNewPath("/").toFSPathString(); // Empty for host! ProMessageHandler msgHandler(true); ProFileCacheManager::instance()->incRefCount(); diff --git a/src/plugins/qtsupport/exampleslistmodel.cpp b/src/plugins/qtsupport/exampleslistmodel.cpp index b5199047177..6d1bcd38404 100644 --- a/src/plugins/qtsupport/exampleslistmodel.cpp +++ b/src/plugins/qtsupport/exampleslistmodel.cpp @@ -487,7 +487,7 @@ void ExampleSetModel::updateQtVersionList() { QtVersions versions = QtVersionManager::sortVersions( QtVersionManager::versions([](const QtVersion *v) { - return !v->qmakeFilePath().needsDevice() && (v->hasExamples() || v->hasDemos()); + return v->qmakeFilePath().isLocal() && (v->hasExamples() || v->hasDemos()); })); // prioritize default qt version diff --git a/src/plugins/qtsupport/qtversionmanager.cpp b/src/plugins/qtsupport/qtversionmanager.cpp index 987b647d871..0ab378f5e6b 100644 --- a/src/plugins/qtsupport/qtversionmanager.cpp +++ b/src/plugins/qtsupport/qtversionmanager.cpp @@ -531,7 +531,7 @@ static AllDocumentationFiles allDocumentationFiles(const QtVersions &versions) { QList<QPair<QtVersion *, QString>> versionsWithDocPath; for (QtVersion *v : versions) { - if (v->hasDocs() && !v->docsPath().needsDevice()) + if (v->hasDocs() && v->docsPath().isLocal()) versionsWithDocPath << qMakePair(v, v->docsPath().path()); } QFuture<QPair<QtVersion *, DocumentationFiles>> future = QtConcurrent::mapped( diff --git a/src/plugins/remotelinux/linuxdevice.cpp b/src/plugins/remotelinux/linuxdevice.cpp index 82821747682..6975372d4b6 100644 --- a/src/plugins/remotelinux/linuxdevice.cpp +++ b/src/plugins/remotelinux/linuxdevice.cpp @@ -1656,7 +1656,7 @@ FileTransferInterface *LinuxDevice::createFileTransferInterface( const FileTransferSetupData &setup) const { if (Utils::anyOf(setup.m_files, - [](const FileToTransfer &f) { return f.m_source.needsDevice(); })) { + [](const FileToTransfer &f) { return !f.m_source.isLocal(); })) { return new GenericTransferImpl(setup); } diff --git a/src/plugins/terminal/shellintegration.cpp b/src/plugins/terminal/shellintegration.cpp index 11dce74eca3..1a70bacc395 100644 --- a/src/plugins/terminal/shellintegration.cpp +++ b/src/plugins/terminal/shellintegration.cpp @@ -58,7 +58,7 @@ struct bool ShellIntegration::canIntegrate(const Utils::CommandLine &cmdLine) { - if (cmdLine.executable().needsDevice()) + if (!cmdLine.executable().isLocal()) return false; // TODO: Allow integration for remote shells if (cmdLine.executable().baseName() == "zsh") diff --git a/src/plugins/terminal/terminalpane.cpp b/src/plugins/terminal/terminalpane.cpp index 8b6699ef77e..e107f55b3d1 100644 --- a/src/plugins/terminal/terminalpane.cpp +++ b/src/plugins/terminal/terminalpane.cpp @@ -106,7 +106,7 @@ void TerminalPane::openTerminal(const OpenTerminalParameters ¶meters) } } - if (parametersCopy.workingDirectory && parametersCopy.workingDirectory->needsDevice() + if (parametersCopy.workingDirectory && !parametersCopy.workingDirectory->isLocal() && !parametersCopy.shellCommand) { const FilePath shell = parametersCopy.workingDirectory->withNewPath( parametersCopy.environment diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 2b5a59cebcc..d2ee214109d 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -64,7 +64,7 @@ VcsBaseClientImpl::VcsBaseClientImpl(VcsBaseSettings *baseSettings) FilePath VcsBaseClientImpl::vcsBinary(const Utils::FilePath &forDirectory) const { - if (forDirectory.needsDevice()) + if (!forDirectory.isLocal()) return {}; return m_baseSettings->binaryPath(); diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp index 49f58bb0687..995fb5c848c 100644 --- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp +++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp @@ -535,7 +535,7 @@ static QString msgCheckScript(const FilePath &workingDir, const FilePath &cmd) bool VcsBaseSubmitEditor::runSubmitMessageCheckScript(const FilePath &checkScript, QString *errorMessage) const { - QTC_ASSERT(!checkScript.needsDevice(), return false); // Not supported below. + QTC_ASSERT(checkScript.isLocal(), return false); // Not supported below. // Write out message TempFileSaver saver(TemporaryDirectory::masterDirectoryPath() + "/msgXXXXXX.txt"); saver.write(fileContents()); |