# HG changeset patch # User David Demelier # Date 1487074067 -3600 # Node ID 58542794338462dd2a36c092ac5e7c1e04fd9231 # Parent bf201d09ee6a50fac9229c10767c53428f9dce40 Irccd: use boost::filesystem (fs::isAbsolute), #594 diff -r bf201d09ee6a -r 585427943384 libcommon/irccd/fs.cpp --- a/libcommon/irccd/fs.cpp Tue Feb 14 13:05:42 2017 +0100 +++ b/libcommon/irccd/fs.cpp Tue Feb 14 13:07:47 2017 +0100 @@ -213,32 +213,6 @@ } /* - * isAbsolute. - * ------------------------------------------------------------------ - */ -bool isAbsolute(const std::string &path) noexcept -{ -#if defined(_WIN32) - return !isRelative(path); -#else - return path.size() > 0 && path[0] == '/'; -#endif -} - -/* - * isRelative. - * ------------------------------------------------------------------ - */ -bool isRelative(const std::string &path) noexcept -{ -#if defined(_WIN32) - return PathIsRelativeA(path.c_str()) == 1; -#else - return !isAbsolute(path); -#endif -} - -/* * isReadable. * ------------------------------------------------------------------ */ diff -r bf201d09ee6a -r 585427943384 libcommon/irccd/fs.hpp --- a/libcommon/irccd/fs.hpp Tue Feb 14 13:05:42 2017 +0100 +++ b/libcommon/irccd/fs.hpp Tue Feb 14 13:07:47 2017 +0100 @@ -169,22 +169,6 @@ #endif // !HAVE_STAT /** - * Check if the path is absolute. - * - * \param path the path - * \return true if the path is absolute - */ -IRCCD_EXPORT bool isAbsolute(const std::string &path) noexcept; - -/** - * Check if the path is relative. - * - * \param path the path - * \return true if the path is absolute - */ -IRCCD_EXPORT bool isRelative(const std::string &path) noexcept; - -/** * Check if the file is readable. * * \param path the path diff -r bf201d09ee6a -r 585427943384 libcommon/irccd/path.cpp --- a/libcommon/irccd/path.cpp Tue Feb 14 13:05:42 2017 +0100 +++ b/libcommon/irccd/path.cpp Tue Feb 14 13:07:47 2017 +0100 @@ -394,9 +394,9 @@ * In the worst case use current working directory. */ if (base.empty()) { - if (fs::isAbsolute(argv0)) + if (boost::filesystem::path(argv0).is_absolute()) { base = argv0; - else { + } else { std::string name = fs::baseName(argv0); for (const auto &dir : util::split(sys::env("PATH"), std::string(1, Separator))) {