diff --git a/CMakeLists.txt b/CMakeLists.txt index a9cf5ab..4996c55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project(xdgcfg - VERSION 0.1.0 + VERSION 0.2.0 LANGUAGES CXX ) diff --git a/src/xdgcfg.cpp b/src/xdgcfg.cpp index a79969c..3c4b09e 100644 --- a/src/xdgcfg.cpp +++ b/src/xdgcfg.cpp @@ -2,21 +2,10 @@ * Author: tastytea */ -#if __cplusplus >= 201703L - #include -#else - #include -#endif #include #include #include "xdgcfg.hpp" -#if __cplusplus >= 201703L - namespace fs = std::filesystem; -#else - namespace fs = std::experimental::filesystem; -#endif - using std::cerr; using std::endl; @@ -31,13 +20,13 @@ xdgcfg::xdgcfg(const string &filename, const string &subdir) if (!subdir.empty()) { - _filepath += '/' + subdir; + _filepath /= subdir; if (!fs::exists(_filepath)) { fs::create_directory(_filepath); } } - _filepath += '/' + filename; + _filepath /= filename; } const uint_fast8_t xdgcfg::read() @@ -92,7 +81,7 @@ libconfig::Config &xdgcfg::get_cfg() return _cfg; } -const string xdgcfg::get_filepath() const +const fs::path xdgcfg::get_filepath() const { return _filepath; } diff --git a/src/xdgcfg.hpp b/src/xdgcfg.hpp index 3b0e0ea..ab62d7f 100644 --- a/src/xdgcfg.hpp +++ b/src/xdgcfg.hpp @@ -5,10 +5,20 @@ #ifndef XDGCFG_HPP #define XDGCFG_HPP +#if __cplusplus >= 201703L + #include +#else + #include +#endif #include #include #include +#if __cplusplus >= 201703L + namespace fs = std::filesystem; +#else + namespace fs = std::experimental::filesystem; +#endif using std::string; using std::uint_fast8_t; @@ -55,7 +65,7 @@ public: /*! * @brief Returns the complete filepath */ - const string get_filepath() const; + const fs::path get_filepath() const; /*! * @brief Sets verbosity @@ -76,7 +86,7 @@ private: /*! * Complete filepath */ - string _filepath; + fs::path _filepath; /*! * Print out error messages if true