diff --git a/src/libs/utils/filepath.cpp b/src/libs/utils/filepath.cpp index a5b3381acc6..f2b3f2a19a9 100644 --- a/src/libs/utils/filepath.cpp +++ b/src/libs/utils/filepath.cpp @@ -826,6 +826,12 @@ DeviceFileAccess *FilePath::fileAccess() const return access; } +bool FilePath::hasFileAccess() const +{ + DeviceFileAccess *access = s_deviceHooks.fileAccess(*this); + return access; +} + /// Constructs a FilePath from \a filePath. The \a defaultExtension is appended /// to \a filename if that does not have an extension already. /// \a filePath is not checked for validity. diff --git a/src/libs/utils/filepath.h b/src/libs/utils/filepath.h index d0fb810e465..eb043effe30 100644 --- a/src/libs/utils/filepath.h +++ b/src/libs/utils/filepath.h @@ -207,6 +207,7 @@ public: // There are usually other means available. E.g. distinguishing based // on FilePath::osType(). bool needsDevice() const; + bool hasFileAccess() const; bool isSameDevice(const FilePath &other) const; bool isSameFile(const FilePath &other) const; diff --git a/src/libs/utils/fsengine/fsengine.cpp b/src/libs/utils/fsengine/fsengine.cpp index 6a9665f6d05..e7150493111 100644 --- a/src/libs/utils/fsengine/fsengine.cpp +++ b/src/libs/utils/fsengine/fsengine.cpp @@ -36,7 +36,8 @@ FilePaths FSEngine::registeredDeviceRoots() void FSEngine::addDevice(const FilePath &deviceRoot) { - deviceRoots().append(deviceRoot); + if (deviceRoot.hasFileAccess()) + deviceRoots().append(deviceRoot); } void FSEngine::removeDevice(const FilePath &deviceRoot)