Utils: Introduce a helper function to prepend or set paths

This is meant for cases where we get a raw ':'/';' separated list of
directories.

Change-Id: I9ef8888f71700d553213949a867f62dec763054c
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
hjk
2023-07-26 12:15:28 +02:00
parent 778a1d75ba
commit a478b9682e
2 changed files with 6 additions and 0 deletions

View File

@@ -149,6 +149,11 @@ void Environment::prependOrSetPath(const FilePath &value)
prependOrSet("PATH", value.nativePath(), OsSpecificAspects::pathListSeparator(osType()));
}
void Environment::prependOrSetPath(const QString &directories)
{
prependOrSet("PATH", directories, OsSpecificAspects::pathListSeparator(osType()));
}
void Environment::appendOrSet(const QString &key, const QString &value, const QString &sep)
{
addItem(Item{std::in_place_index_t<AppendOrSet>(), key, value, sep});

View File

@@ -48,6 +48,7 @@ public:
void appendOrSetPath(const FilePath &value);
void prependOrSetPath(const FilePath &value);
void prependOrSetPath(const QString &directories); // Could be several ':'/';' separated entries.
void prependOrSetLibrarySearchPath(const FilePath &value);
void prependOrSetLibrarySearchPaths(const FilePaths &values);