utility: added FilePath abstraction and rewrote data management to use it

The utility class FilePath wraps an instance of boost::filesystem::path. Using FilePath allows for easy comparision of
file paths on different platforms using absolute or relative paths. Whereever file paths are compared, this wrapper
should be used.
This commit is contained in:
Eberhard Graether
2015-03-09 01:51:32 +01:00
parent 7014c8ac4c
commit df888e4151
37 changed files with 387 additions and 126 deletions
+33
View File
@@ -0,0 +1,33 @@
#ifndef FILE_PATH_H
#define FILE_PATH_H
#include <string>
#include "boost/filesystem.hpp"
class FilePath
{
public:
FilePath(const char* filePath);
FilePath(const std::string& filePath);
FilePath(const boost::filesystem::path& filePath);
bool exists() const;
std::string str() const;
std::string absoluteStr() const;
std::string fileName() const;
std::string extension() const;
FilePath withoutExtension() const;
bool hasExtension(const std::vector<std::string>& extensions) const;
bool operator==(const FilePath& other) const;
bool operator!=(const FilePath& other) const;
bool operator<(const FilePath& other) const;
private:
boost::filesystem::path m_path;
};
#endif // FILE_PATH_H