comparison irccdctl/main.cpp @ 486:0b156b82b8c1

Irccd: rework of paths, closes #611
author David Demelier <markand@malikania.fr>
date Thu, 20 Jul 2017 15:12:41 +0200
parents bf201d09ee6a
children 7e273b7f4f92
comparison
equal deleted inserted replaced
485:daf3aa8b2ddb 486:0b156b82b8c1
29 #include "fs.hpp" 29 #include "fs.hpp"
30 #include "ini.hpp" 30 #include "ini.hpp"
31 #include "irccdctl.hpp" 31 #include "irccdctl.hpp"
32 #include "logger.hpp" 32 #include "logger.hpp"
33 #include "options.hpp" 33 #include "options.hpp"
34 #include "path.hpp"
35 #include "system.hpp" 34 #include "system.hpp"
36 #include "util.hpp" 35 #include "util.hpp"
37 36
38 using namespace std::string_literals; 37 using namespace std::string_literals;
39 using namespace fmt::literals; 38 using namespace fmt::literals;
558 auto it = result.find("-c"); 557 auto it = result.find("-c");
559 558
560 if (it != result.end() || (it = result.find("--config")) != result.end()) 559 if (it != result.end() || (it = result.find("--config")) != result.end())
561 read(it->second); 560 read(it->second);
562 else { 561 else {
563 for (const std::string &dir : path::list(path::PathConfig)) { 562 for (const auto& path : sys::config_filenames("irccdctl.conf")) {
564 boost::system::error_code ec; 563 boost::system::error_code ec;
565 std::string path = dir + "irccdctl.conf";
566 564
567 if (boost::filesystem::exists(path, ec) && !ec) { 565 if (boost::filesystem::exists(path, ec) && !ec) {
568 read(path); 566 read(path);
569 break; 567 break;
570 } 568 }