diff options
Diffstat (limited to 'Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp')
-rw-r--r-- | Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp index f3efed020b0..32a9be68149 100644 --- a/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp +++ b/Build/source/texk/dvisvgm/dvisvgm-src/src/FilePath.hpp @@ -28,8 +28,8 @@ class FilePath { class Directory { public: - Directory (const std::string &dir) : _dirstr(dir) {} - Directory (std::string &&dir) : _dirstr(std::move(dir)) {} + explicit Directory (std::string dir) : _dirstr(std::move(dir)) {} + explicit Directory (std::string &&dir) : _dirstr(std::move(dir)) {} bool operator == (const Directory &dir) const; bool operator != (const Directory &dir) const {return !(*this == dir);} explicit operator std::string () const {return _dirstr;} @@ -39,12 +39,17 @@ class FilePath { }; public: - FilePath (const std::string &path) {set(path);} + FilePath () =default; + explicit FilePath (const std::string &path) {set(path);} FilePath (const std::string &path, bool isfile) : FilePath(path, isfile, "") {} FilePath (const std::string &path, bool isfile, const std::string ¤t_dir); void set (const std::string &path); + void set (const std::string &path, bool isfile); + void set (const std::string &path, bool isfile, const std::string ¤t_dir); std::string absolute (bool with_filename=true) const; std::string relative (std::string reldir="", bool with_filename=true) const; + std::string relative (const FilePath &filepath, bool with_filename=true) const; + std::string shorterAbsoluteOrRelative (std::string reldir="", bool with_filename=true) const; std::string basename () const; std::string suffix () const; void suffix (const std::string &s); @@ -53,16 +58,18 @@ class FilePath { bool empty () const {return _dirs.empty() && _fname.empty();} const std::string& filename () const {return _fname;} void filename (const std::string &fname) {_fname = fname;} + bool exists () const; + static bool isAbsolute (std::string path); protected: void init (std::string path, bool isfile, std::string current_dir); void add (const std::string &elem); private: - std::vector<std::string> _dirs; + std::vector<Directory> _dirs; std::string _fname; #ifdef _WIN32 - char _drive; + char _drive=0; #endif }; |