changeset 484:69cc48b46dcb

Irccd: use boost::filesystem (fs::cwd), #594
author David Demelier <markand@malikania.fr>
date Thu, 16 Feb 2017 13:25:08 +0100
parents b6bc4ddf791c
children daf3aa8b2ddb
files libcommon/irccd/fs.hpp libcommon/irccd/path.cpp
diffstat 2 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libcommon/irccd/fs.hpp	Thu Feb 16 13:19:43 2017 +0100
+++ b/libcommon/irccd/fs.hpp	Thu Feb 16 13:25:08 2017 +0100
@@ -270,14 +270,6 @@
     return findIf(base, [&] (const auto &, const auto &entry) { return std::regex_match(entry.name, regex); });
 }
 
-/**
- * Get the current working directory.
- *
- * \return the current working directory
- * \throw std::runtime_error on failure
- */
-IRCCD_EXPORT std::string cwd();
-
 } // !fs
 
 } // !irccd
--- a/libcommon/irccd/path.cpp	Thu Feb 16 13:19:43 2017 +0100
+++ b/libcommon/irccd/path.cpp	Thu Feb 16 13:25:08 2017 +0100
@@ -510,6 +510,7 @@
     assert(path >= PathConfig && path <= PathNativePlugins);
 
     std::vector<std::string> list;
+    boost::system::error_code ec;
 
     switch (path) {
     case PathCache:
@@ -525,12 +526,12 @@
         list.push_back(clean(systemData()));
         break;
     case PathPlugins:
-        list.push_back(clean(fs::cwd()));
+        list.push_back(clean(boost::filesystem::current_path(ec).string()));
         list.push_back(clean(userPlugins()));
         list.push_back(clean(systemPlugins()));
         break;
     case PathNativePlugins:
-        list.push_back(clean(fs::cwd()));
+        list.push_back(clean(boost::filesystem::current_path(ec).string()));
         list.push_back(clean(systemNativePlugins()));
         break;
     default: