forked from qt-creator/qt-creator
Utils: Add FilePath::isLocal() and use it instead of !needsDevice()
"needsDevice()" is an odd name, but keep it for now until downstream has caught up. Change-Id: I1fdb65d55e84e31512edb8f0bea8a0a3f7b2879c Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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());
|
||||
|
@@ -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;
|
||||
|
@@ -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());
|
||||
|
@@ -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) {
|
||||
|
@@ -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;
|
||||
|
@@ -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);
|
||||
}
|
||||
|
@@ -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()) {
|
||||
|
@@ -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!)
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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) {
|
||||
|
@@ -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(
|
||||
|
@@ -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
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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 {};
|
||||
}
|
||||
|
||||
|
@@ -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();
|
||||
|
@@ -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(
|
||||
|
@@ -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.")
|
||||
|
@@ -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();
|
||||
|
@@ -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();
|
||||
|
@@ -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;
|
||||
|
@@ -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)
|
||||
|
@@ -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.
|
||||
|
@@ -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);
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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()) {
|
||||
|
@@ -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()}});
|
||||
|
@@ -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())
|
||||
|
@@ -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;
|
||||
|
@@ -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();
|
||||
|
@@ -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 {};
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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) {
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -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 {
|
||||
|
@@ -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});
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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);
|
||||
|
@@ -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()));
|
||||
}
|
||||
|
@@ -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()) {
|
||||
|
@@ -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."));
|
||||
|
@@ -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());
|
||||
}
|
||||
|
@@ -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.");
|
||||
|
@@ -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 {};
|
||||
}
|
||||
|
@@ -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 {};
|
||||
|
@@ -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();
|
||||
|
@@ -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
|
||||
|
@@ -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(
|
||||
|
@@ -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);
|
||||
}
|
||||
|
||||
|
@@ -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")
|
||||
|
@@ -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
|
||||
|
@@ -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();
|
||||
|
@@ -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());
|
||||
|
@@ -662,8 +662,8 @@ void tst_filepath::toString()
|
||||
|
||||
FilePath filePath = FilePath::fromParts(scheme, host, path);
|
||||
QCOMPARE(filePath.toString(), result);
|
||||
QString cleanedOutput = filePath.needsDevice() ? filePath.toUserOutput()
|
||||
: QDir::cleanPath(filePath.toUserOutput());
|
||||
QString cleanedOutput = filePath.isLocal() ? QDir::cleanPath(filePath.toUserOutput())
|
||||
: filePath.toUserOutput();
|
||||
QCOMPARE(cleanedOutput, userResult);
|
||||
}
|
||||
|
||||
@@ -728,8 +728,8 @@ void tst_filepath::toFSPathString()
|
||||
|
||||
FilePath filePath = FilePath::fromParts(scheme, host, path);
|
||||
QCOMPARE(filePath.toFSPathString(), result);
|
||||
QString cleanedOutput = filePath.needsDevice() ? filePath.toUserOutput()
|
||||
: QDir::cleanPath(filePath.toUserOutput());
|
||||
QString cleanedOutput = filePath.isLocal() ? QDir::cleanPath(filePath.toUserOutput())
|
||||
: filePath.toUserOutput();
|
||||
QCOMPARE(cleanedOutput, userResult);
|
||||
}
|
||||
|
||||
|
@@ -158,19 +158,19 @@ void tst_fsengine::testListDir()
|
||||
void tst_fsengine::testWindowsPaths()
|
||||
{
|
||||
// Test upper-case "C:"
|
||||
QVERIFY(FilePath::fromString("C:/__qtc_devices__/device/{cd6c7e4b-12fd-43ca-9bb2-053a38e6b7c5}")
|
||||
.needsDevice());
|
||||
QVERIFY(!FilePath::fromString("C:/__qtc_devices__/device/{cd6c7e4b-12fd-43ca-9bb2-053a38e6b7c5}")
|
||||
.isLocal());
|
||||
|
||||
// Test lower-case "C:"
|
||||
QVERIFY(FilePath::fromString("c:/__qtc_devices__/device/{cd6c7e4b-12fd-43ca-9bb2-053a38e6b7c5}")
|
||||
.needsDevice());
|
||||
QVERIFY(!FilePath::fromString("c:/__qtc_devices__/device/{cd6c7e4b-12fd-43ca-9bb2-053a38e6b7c5}")
|
||||
.isLocal());
|
||||
}
|
||||
|
||||
void tst_fsengine::testUrl()
|
||||
{
|
||||
FilePath p = FilePath::fromString(makeTestPath("", true));
|
||||
|
||||
QVERIFY(p.needsDevice());
|
||||
QVERIFY(!p.isLocal());
|
||||
}
|
||||
|
||||
void tst_fsengine::testBrokenWindowsPath()
|
||||
|
Reference in New Issue
Block a user