aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libs/utils/fileutils.cpp10
-rw-r--r--src/libs/utils/fileutils.h7
-rw-r--r--src/plugins/projectexplorer/devicesupport/devicemanager.cpp6
3 files changed, 22 insertions, 1 deletions
diff --git a/src/libs/utils/fileutils.cpp b/src/libs/utils/fileutils.cpp
index e44faa5e087..a4704bf696d 100644
--- a/src/libs/utils/fileutils.cpp
+++ b/src/libs/utils/fileutils.cpp
@@ -1387,6 +1387,16 @@ FilePath FilePath::onDeviceSearchInPath() const
return Environment::systemEnvironment().searchInPath(path());
}
+Environment FilePath::deviceEnvironment() const
+{
+ if (needsDevice()) {
+ QTC_ASSERT(s_deviceHooks.environment, return {});
+ return s_deviceHooks.environment(*this);
+ }
+ return Environment::systemEnvironment();
+}
+
+
FilePath FilePath::pathAppended(const QString &path) const
{
FilePath fn = *this;
diff --git a/src/libs/utils/fileutils.h b/src/libs/utils/fileutils.h
index 0d8d48d0285..07792a7faca 100644
--- a/src/libs/utils/fileutils.h
+++ b/src/libs/utils/fileutils.h
@@ -40,7 +40,10 @@
#include <functional>
#include <memory>
-namespace Utils { class FilePath; }
+namespace Utils {
+class Environment;
+class FilePath;
+} // Utils
QT_BEGIN_NAMESPACE
class QDataStream;
@@ -91,6 +94,7 @@ public:
std::function<QDateTime(const FilePath &)> lastModified;
std::function<QFile::Permissions(const FilePath &)> permissions;
std::function<OsType(const FilePath &)> osType;
+ std::function<Environment(const FilePath &)> environment;
};
class QTCREATOR_UTILS_EXPORT FilePath
@@ -213,6 +217,7 @@ public:
static void setDeviceFileHooks(const DeviceFileHooks &hooks);
FilePath onDeviceSearchInPath() const;
+ Environment deviceEnvironment() const;
private:
friend class ::tst_fileutils;
diff --git a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
index 97c700eb2b5..32ff16cf3a0 100644
--- a/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
+++ b/src/plugins/projectexplorer/devicesupport/devicemanager.cpp
@@ -507,6 +507,12 @@ DeviceManager::DeviceManager(bool isInstance) : d(std::make_unique<DeviceManager
return device->osType();
};
+ deviceHooks.environment = [](const FilePath &filePath) {
+ auto device = DeviceManager::deviceForPath(filePath);
+ QTC_ASSERT(device, return Environment{});
+ return device->systemEnvironment();
+ };
+
FilePath::setDeviceFileHooks(deviceHooks);
DeviceProcessHooks processHooks;