diff --git a/src/Config.cpp b/src/Config.cpp index 1366ce831..ce41a2f38 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -32,6 +32,7 @@ #include #include #include +#include "Path.h" #include "Config.h" #include "text.h" #include "util.h" @@ -99,16 +100,16 @@ bool Config::load (const std::string& file, int nest /* = 1 */) std::string::size_type include = line.find ("include"); // no i18n. if (include != std::string::npos) { - std::string included = expandPath ( trim ( line.substr (include + 7), " \t")); - if (isAbsolutePath (included)) + Path included (expandPath (trim (line.substr (include + 7), " \t"))); + if (isAbsolutePath (included.data)) { - if (!access (included.c_str (), F_OK | R_OK)) - this->load (included, nest + 1); + if (included.readable ()) + this->load (included.data, nest + 1); else - throw std::string ("Could not read include file '") + included + "'"; + throw std::string ("Could not read include file '") + included.data + "'"; } else - throw std::string ("Can only include files with absolute paths, not '") + included + "'"; + throw std::string ("Can only include files with absolute paths, not '") + included.data + "'"; } else throw std::string ("Malformed entry in ") + file + ": '" + line + "'"; @@ -293,7 +294,8 @@ void Config::createDefaultRC (const std::string& rc, const std::string& data) //////////////////////////////////////////////////////////////////////////////// void Config::createDefaultData (const std::string& data) { - if (access (data.c_str (), F_OK)) + Path p (data); + if (! p.exists ()) mkdir (data.c_str (), S_IRWXU); }