Files
Sourcetrail/src/lib/utility/file/FilePath.h
T
Andreas Stallinger a2cba0b94f logic: enviroment variable handling
* expanding env vars for existsens check
* expand source paths in filemanager
2016-04-14 13:39:48 +02:00

52 lines
1.2 KiB
C++

#ifndef FILE_PATH_H
#define FILE_PATH_H
#include <string>
#include "boost/filesystem.hpp"
class FilePath
{
public:
FilePath();
FilePath(const char* filePath);
FilePath(const std::string& filePath);
FilePath(const boost::filesystem::path& filePath);
boost::filesystem::path path() const;
bool empty() const;
bool exists() const;
bool isDirectory() const;
bool isAbsolute() const;
FilePath parentDirectory() const;
FilePath absolute() const;
FilePath canonical() const;
FilePath relativeTo(const FilePath& other) const;
FilePath concat(const FilePath& other) const;
FilePath expandEnvironmentVariables() const;
std::string expandEnvironmentVariables(const std::string & path) const;
std::string str() const;
std::string fileName() const;
std::string extension() const;
FilePath withoutExtension() const;
FilePath replaceExtension(const std::string& extension);
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:
void init();
boost::filesystem::path m_path;
bool m_exists;
};
#endif // FILE_PATH_H