Mercurial > irccd
changeset 479:298cae7487dc
Irccd: use boost::filesystem (fs::mkdir), #594
author | David Demelier <markand@malikania.fr> |
---|---|
date | Thu, 16 Feb 2017 12:52:23 +0100 |
parents | 585427943384 |
children | 2c7cb5b936b4 |
files | libcommon/irccd/fs.hpp libirccd-js/irccd/mod-directory.cpp |
diffstat | 2 files changed, 3 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libcommon/irccd/fs.hpp Tue Feb 14 13:07:47 2017 +0100 +++ b/libcommon/irccd/fs.hpp Thu Feb 16 12:52:23 2017 +0100 @@ -222,16 +222,6 @@ IRCCD_EXPORT std::vector<Entry> readdir(const std::string &path, int flags = 0); /** - * Create a directory recursively. - * - * \param path the path - * \param mode the optional mode (not always supported) - * \throw std::runtime_error on failure - * \post all intermediate directories are created - */ -IRCCD_EXPORT void mkdir(const std::string &path, int mode = 0700); - -/** * Remove a directory recursively. * * If errors happens, they are silently discarded to remove as much as possible.
--- a/libirccd-js/irccd/mod-directory.cpp Tue Feb 14 13:07:47 2017 +0100 +++ b/libirccd-js/irccd/mod-directory.cpp Thu Feb 16 12:52:23 2017 +0100 @@ -24,6 +24,8 @@ #include <stdexcept> #include <string> +#include <boost/filesystem.hpp> + #include "duktape.hpp" #include "fs.hpp" #include "mod-directory.hpp" @@ -329,17 +331,13 @@ * * Arguments: * - path, the path to the directory, - * - mode, the mode, not available on all platforms. * Throws: * - Any exception on error. */ duk_ret_t funcMkdir(duk_context *ctx) { try { - fs::mkdir( - duk_require_string(ctx, 0), - duk_is_number(ctx, 1) ? duk_get_int(ctx, 1) : 0700 - ); + boost::filesystem::create_directories(duk_require_string(ctx, 0)); } catch (const std::exception &ex) { dukx_throw(ctx, SystemError(errno, ex.what())); }