logic: Fixed FilePath to not expand environment variables in constructor
This commit is contained in:
@@ -28,6 +28,13 @@ std::vector<FilePath> ApplicationSettings::getHeaderSearchPaths() const
|
||||
return getPathValues("source/header_search_paths/header_search_path");
|
||||
}
|
||||
|
||||
std::vector<FilePath> ApplicationSettings::getHeaderSearchPathsExpanded() const
|
||||
{
|
||||
std::vector<FilePath> paths = getPathValues("source/header_search_paths/header_search_path");
|
||||
expandPaths(paths);
|
||||
return paths;
|
||||
}
|
||||
|
||||
bool ApplicationSettings::setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths)
|
||||
{
|
||||
return setPathValues("source/header_search_paths/header_search_path", headerSearchPaths);
|
||||
@@ -38,6 +45,13 @@ std::vector<FilePath> ApplicationSettings::getFrameworkSearchPaths() const
|
||||
return getPathValues("source/framework_search_paths/framework_search_path");
|
||||
}
|
||||
|
||||
std::vector<FilePath> ApplicationSettings::getFrameworkSearchPathsExpanded() const
|
||||
{
|
||||
std::vector<FilePath> paths = getPathValues("source/framework_search_paths/framework_search_path");
|
||||
expandPaths(paths);
|
||||
return paths;
|
||||
}
|
||||
|
||||
bool ApplicationSettings::setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths)
|
||||
{
|
||||
return setPathValues("source/framework_search_paths/framework_search_path", frameworkSearchPaths);
|
||||
|
||||
@@ -16,9 +16,11 @@ public:
|
||||
|
||||
// source
|
||||
std::vector<FilePath> getHeaderSearchPaths() const;
|
||||
std::vector<FilePath> getHeaderSearchPathsExpanded() const;
|
||||
bool setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
|
||||
|
||||
std::vector<FilePath> getFrameworkSearchPaths() const;
|
||||
std::vector<FilePath> getFrameworkSearchPathsExpanded() const;
|
||||
bool setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths);
|
||||
|
||||
std::vector<std::string> getCompilerFlags() const;
|
||||
|
||||
@@ -93,6 +93,7 @@ std::vector<FilePath> ProjectSettings::getSourcePaths() const
|
||||
std::vector<FilePath> ProjectSettings::getAbsoluteSourcePaths() const
|
||||
{
|
||||
std::vector<FilePath> paths = getSourcePaths();
|
||||
expandPaths(paths);
|
||||
makePathsAbsolute(paths);
|
||||
return paths;
|
||||
}
|
||||
@@ -110,6 +111,7 @@ std::vector<FilePath> ProjectSettings::getHeaderSearchPaths() const
|
||||
std::vector<FilePath> ProjectSettings::getAbsoluteHeaderSearchPaths() const
|
||||
{
|
||||
std::vector<FilePath> paths = getHeaderSearchPaths();
|
||||
expandPaths(paths);
|
||||
makePathsAbsolute(paths);
|
||||
return paths;
|
||||
}
|
||||
@@ -127,6 +129,7 @@ std::vector<FilePath> ProjectSettings::getFrameworkSearchPaths() const
|
||||
std::vector<FilePath> ProjectSettings::getAbsoluteFrameworkSearchPaths() const
|
||||
{
|
||||
std::vector<FilePath> paths = getFrameworkSearchPaths();
|
||||
expandPaths(paths);
|
||||
makePathsAbsolute(paths);
|
||||
return paths;
|
||||
}
|
||||
@@ -242,7 +245,6 @@ void ProjectSettings::makePathsAbsolute(std::vector<FilePath>& paths) const
|
||||
FilePath basePath = getFilePath().parentDirectory();
|
||||
for (size_t i = 0; i < paths.size(); i++)
|
||||
{
|
||||
paths[i] = paths[i].expandEnvironmentVariables();
|
||||
if (!paths[i].isAbsolute())
|
||||
{
|
||||
paths[i] = basePath.concat(paths[i]).canonical();
|
||||
|
||||
@@ -102,6 +102,14 @@ std::vector<FilePath> Settings::getPathValues(const std::string& key) const
|
||||
return paths;
|
||||
}
|
||||
|
||||
void Settings::expandPaths(std::vector<FilePath>& paths) const
|
||||
{
|
||||
for (FilePath& path : paths)
|
||||
{
|
||||
path = path.expandEnvironmentVariables();
|
||||
}
|
||||
}
|
||||
|
||||
bool Settings::setPathValues(const std::string& key, const std::vector<FilePath>& paths)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
|
||||
@@ -34,6 +34,7 @@ protected:
|
||||
std::vector<T> getValues(const std::string& key, std::vector<T> defaultValues) const;
|
||||
|
||||
std::vector<FilePath> getPathValues(const std::string& key) const;
|
||||
void expandPaths(std::vector<FilePath>& paths) const;
|
||||
|
||||
template<typename T>
|
||||
bool setValue(const std::string& key, T value);
|
||||
|
||||
Reference in New Issue
Block a user