# HG changeset patch # User David Demelier # Date 1487246184 -3600 # Node ID 2c7cb5b936b48ccbe483f90cc1075853af032eaa # Parent 298cae7487dc95e635e2c8cdca992a7c576d65d9 Irccd: use boost::filesystem (fs::rmdir), #594 diff -r 298cae7487dc -r 2c7cb5b936b4 libcommon/irccd/fs.hpp --- a/libcommon/irccd/fs.hpp Thu Feb 16 12:52:23 2017 +0100 +++ b/libcommon/irccd/fs.hpp Thu Feb 16 12:56:24 2017 +0100 @@ -222,15 +222,6 @@ IRCCD_EXPORT std::vector readdir(const std::string &path, int flags = 0); /** - * Remove a directory recursively. - * - * If errors happens, they are silently discarded to remove as much as possible. - * - * \param path the path - */ -IRCCD_EXPORT void rmdir(const std::string &path) noexcept; - -/** * Search an item recursively. * * The predicate must have the following signature: diff -r 298cae7487dc -r 2c7cb5b936b4 libirccd-js/irccd/mod-directory.cpp --- a/libirccd-js/irccd/mod-directory.cpp Thu Feb 16 12:52:23 2017 +0100 +++ b/libirccd-js/irccd/mod-directory.cpp Thu Feb 16 12:56:24 2017 +0100 @@ -174,14 +174,13 @@ if (!fs::isDirectory(path)) dukx_throw(ctx, SystemError(EINVAL, "not a directory")); + boost::system::error_code ec; + if (!recursive) { -#if defined(_WIN32) - ::RemoveDirectory(path.c_str()); -#else - ::remove(path.c_str()); -#endif - } else - fs::rmdir(path.c_str()); + boost::filesystem::remove(path, ec); + } else { + boost::filesystem::remove_all(path, ec); + } return 0; }