Mercurial > irccd
comparison libcommon/irccd/ini.cpp @ 700:91bc29e87399
Irccd: use Boost.Predef, closes #805 @1h
author | David Demelier <markand@malikania.fr> |
---|---|
date | Wed, 09 May 2018 22:34:47 +0200 |
parents | af963ff03c06 |
children |
comparison
equal
deleted
inserted
replaced
699:808171f7bfa2 | 700:91bc29e87399 |
---|---|
24 #include <sstream> | 24 #include <sstream> |
25 #include <stdexcept> | 25 #include <stdexcept> |
26 | 26 |
27 #include <irccd/sysconfig.hpp> | 27 #include <irccd/sysconfig.hpp> |
28 | 28 |
29 #include <boost/predef.h> | |
30 | |
29 // for PathIsRelative. | 31 // for PathIsRelative. |
30 #if defined(IRCCD_SYSTEM_WINDOWS) | 32 #if BOOST_OS_WINDOWS |
31 # include <shlwapi.h> | 33 # include <shlwapi.h> |
32 #endif | 34 #endif |
33 | 35 |
34 #include "ini.hpp" | 36 #include "ini.hpp" |
35 | 37 |
42 using stream_iterator = std::istreambuf_iterator<char>; | 44 using stream_iterator = std::istreambuf_iterator<char>; |
43 using token_iterator = std::vector<token>::const_iterator; | 45 using token_iterator = std::vector<token>::const_iterator; |
44 | 46 |
45 inline bool is_absolute(const std::string& path) noexcept | 47 inline bool is_absolute(const std::string& path) noexcept |
46 { | 48 { |
47 #if defined(IRCCD_SYSTEM_WINDOWS) | 49 #if BOOST_OS_WINDOWS |
48 return !PathIsRelative(path.c_str()); | 50 return !PathIsRelative(path.c_str()); |
49 #else | 51 #else |
50 return path.size() > 0 && path[0] == '/'; | 52 return path.size() > 0 && path[0] == '/'; |
51 #endif | 53 #endif |
52 } | 54 } |
286 | 288 |
287 std::string value = (it++)->value(); | 289 std::string value = (it++)->value(); |
288 std::string file; | 290 std::string file; |
289 | 291 |
290 if (!is_absolute(value)) { | 292 if (!is_absolute(value)) { |
291 #if defined(IRCCD_SYSTEM_WINDOWS) | 293 #if BOOST_OS_WINDOWS |
292 file = path + "\\" + value; | 294 file = path + "\\" + value; |
293 #else | 295 #else |
294 file = path + "/" + value; | 296 file = path + "/" + value; |
295 #endif | 297 #endif |
296 } else | 298 } else |