logic: fixed relative project settings paths

* when specifying relative paths in project settings these stay relative when saving and loading them now.
This commit is contained in:
malte_langkabel
2016-03-15 12:54:44 +01:00
parent ba523111af
commit c398302e4d
8 changed files with 50 additions and 59 deletions
-41
View File
@@ -102,25 +102,6 @@ std::vector<FilePath> Settings::getPathValues(const std::string& key) const
return paths;
}
std::vector<FilePath> Settings::getRelativePathValues(const std::string& key) const
{
std::vector<std::string> values;
values = getValues(key, values);
std::vector<FilePath> paths;
for (const std::string& path : values)
{
FilePath filePath(path);
if (!filePath.isAbsolute())
{
filePath = m_filePath.parentDirectory().concat(filePath);
}
paths.push_back(filePath.canonical());
}
return paths;
}
bool Settings::setPathValues(const std::string& key, const std::vector<FilePath>& paths)
{
std::vector<std::string> values;
@@ -132,28 +113,6 @@ bool Settings::setPathValues(const std::string& key, const std::vector<FilePath>
return setValues(key, values);
}
bool Settings::moveRelativePathValues(const std::string& key, const FilePath& filePath)
{
std::vector<std::string> values;
values = getValues(key, values);
FilePath oldPath = m_filePath.absolute();
FilePath newPath = filePath.absolute();
for (size_t i = 0; i < values.size(); i++)
{
FilePath path(values[i]);
if (!path.isAbsolute())
{
path = oldPath.parentDirectory().concat(path);
path = path.canonical().relativeTo(newPath);
values[i] = path.str();
}
}
return setValues(key, values);
}
bool Settings::isValueDefined(const std::string& key) const
{
return m_config->isValueDefined(key);