logic: paths in ProjectSettings relative to file not working directory

This change checks all paths in the ProjectSettings file for relativity and makes them relative to the location of the
ProjectSettings file if necessary. The paths are also correctly saved relative to the file.
This commit is contained in:
Eberhard Graether
2015-07-29 22:20:26 +02:00
parent 336df76912
commit 5f25311389
31 changed files with 407 additions and 148 deletions
+13 -3
View File
@@ -6,34 +6,44 @@
#include <vector>
#include "utility/ConfigManager.h"
#include "utility/file/FilePath.h"
class Settings
{
public:
virtual ~Settings();
bool load(const std::string& filePath);
bool load(const FilePath& filePath);
void save();
void save(const std::string& filePath);
virtual void save(const FilePath& filePath);
void clear();
protected:
Settings();
const FilePath& getFilePath() const;
void setFilePath(const FilePath& filePath);
template<typename T>
T getValue(const std::string& key, T defaultValue) const;
template<typename T>
std::vector<T> getValues(const std::string& key, std::vector<T> defaultValues) const;
std::vector<FilePath> getPathValues(const std::string& key) const;
std::vector<FilePath> getRelativePathValues(const std::string& key) const;
template<typename T>
bool setValue(const std::string& key, T value);
template<typename T>
bool setValues(const std::string& key, std::vector<T> values);
bool setPathValues(const std::string& key, const std::vector<FilePath>& paths);
bool moveRelativePathValues(const std::string& key, const FilePath& filePath);
private:
std::string m_filePath;
FilePath m_filePath;
std::shared_ptr<ConfigManager> m_config;
};