Switch to fs::path where appropriate.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
f57555fb3a
commit
cf8fb95777
|
@ -24,6 +24,7 @@
|
|||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -32,6 +33,7 @@ namespace epubgrep
|
|||
{
|
||||
|
||||
namespace po = boost::program_options;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
using boost::locale::translate;
|
||||
using std::cout;
|
||||
|
@ -83,7 +85,7 @@ po::variables_map parse_options(int argc, char *argv[])
|
|||
return vm;
|
||||
}
|
||||
|
||||
std::string get_config_path()
|
||||
fs::path get_config_path()
|
||||
{
|
||||
auto get_env = [](std::string const &name)
|
||||
{
|
||||
|
@ -96,21 +98,21 @@ std::string get_config_path()
|
|||
return "";
|
||||
};
|
||||
|
||||
std::string path{get_env("XDG_CONFIG_HOME")};
|
||||
fs::path path{get_env("XDG_CONFIG_HOME")};
|
||||
if (path.empty())
|
||||
{
|
||||
path = get_env("HOME");
|
||||
if (!path.empty())
|
||||
{
|
||||
path += "/.config";
|
||||
path /= ".config";
|
||||
}
|
||||
}
|
||||
if (!path.empty())
|
||||
{
|
||||
path += "/";
|
||||
return path /= "epubgrep.conf";
|
||||
}
|
||||
|
||||
return path += "epubgrep.conf";
|
||||
return "epubgrep.conf";
|
||||
}
|
||||
|
||||
} // namespace epubgrep
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include <boost/program_options/variables_map.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <filesystem>
|
||||
|
||||
namespace epubgrep
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ po::variables_map parse_options(int argc, char *argv[]);
|
|||
* If HOME is set: ${HOME}/.config/epubgrep.conf
|
||||
* Otherwise: epubgrep.conf
|
||||
*/
|
||||
std::string get_config_path();
|
||||
std::filesystem::path get_config_path();
|
||||
|
||||
} // namespace epubgrep
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user