operations.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. // boost/filesystem/operations.hpp ---------------------------------------------------//
  2. // Copyright Beman Dawes 2002-2009
  3. // Copyright Jan Langer 2002
  4. // Copyright Dietmar Kuehl 2001
  5. // Copyright Vladimir Prus 2002
  6. // Copyright Andrey Semashev 2020-2021
  7. // Distributed under the Boost Software License, Version 1.0.
  8. // See http://www.boost.org/LICENSE_1_0.txt
  9. // Library home page: http://www.boost.org/libs/filesystem
  10. //--------------------------------------------------------------------------------------//
  11. #ifndef BOOST_FILESYSTEM_OPERATIONS_HPP
  12. #define BOOST_FILESYSTEM_OPERATIONS_HPP
  13. #include <boost/filesystem/config.hpp>
  14. #include <boost/filesystem/path.hpp>
  15. #include <boost/filesystem/file_status.hpp>
  16. #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
  17. // These includes are left for backward compatibility and should be included directly by users, as needed
  18. #include <boost/filesystem/exception.hpp>
  19. #include <boost/filesystem/directory.hpp>
  20. #endif
  21. #include <boost/detail/bitmask.hpp>
  22. #include <boost/core/scoped_enum.hpp>
  23. #include <boost/system/error_code.hpp>
  24. #include <boost/cstdint.hpp>
  25. #include <string>
  26. #include <ctime>
  27. #include <boost/filesystem/detail/header.hpp> // must be the last #include
  28. //--------------------------------------------------------------------------------------//
  29. namespace boost {
  30. namespace filesystem {
  31. struct space_info
  32. {
  33. // all values are byte counts
  34. boost::uintmax_t capacity;
  35. boost::uintmax_t free; // <= capacity
  36. boost::uintmax_t available; // <= free
  37. };
  38. BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(copy_options, unsigned int)
  39. {
  40. none = 0u, // Default. For copy_file: error if the target file exists. For copy: do not recurse, follow symlinks, copy file contents.
  41. // copy_file options:
  42. skip_existing = 1u, // Don't overwrite the existing target file, don't report an error
  43. overwrite_existing = 1u << 1, // Overwrite existing file
  44. update_existing = 1u << 2, // Overwrite existing file if its last write time is older than the replacement file
  45. synchronize_data = 1u << 3, // Flush all buffered data written to the target file to permanent storage
  46. synchronize = 1u << 4, // Flush all buffered data and attributes written to the target file to permanent storage
  47. // copy options:
  48. recursive = 1u << 8, // Recurse into sub-directories
  49. copy_symlinks = 1u << 9, // Copy symlinks as symlinks instead of copying the referenced file
  50. skip_symlinks = 1u << 10, // Don't copy symlinks
  51. directories_only = 1u << 11, // Only copy directory structure, do not copy non-directory files
  52. create_symlinks = 1u << 12, // Create symlinks instead of copying files
  53. create_hard_links = 1u << 13, // Create hard links instead of copying files
  54. _detail_recursing = 1u << 14 // Internal use only, do not use
  55. }
  56. BOOST_SCOPED_ENUM_DECLARE_END(copy_options)
  57. BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(copy_options))
  58. #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
  59. BOOST_SCOPED_ENUM_DECLARE_BEGIN(copy_option)
  60. {
  61. none = static_cast< unsigned int >(copy_options::none),
  62. fail_if_exists = none,
  63. overwrite_if_exists = static_cast< unsigned int >(copy_options::overwrite_existing)
  64. }
  65. BOOST_SCOPED_ENUM_DECLARE_END(copy_option)
  66. #endif
  67. //--------------------------------------------------------------------------------------//
  68. // implementation details //
  69. //--------------------------------------------------------------------------------------//
  70. namespace detail {
  71. BOOST_FILESYSTEM_DECL
  72. path absolute(path const& p, path const& base, system::error_code* ec = 0);
  73. BOOST_FILESYSTEM_DECL
  74. file_status status(path const& p, system::error_code* ec = 0);
  75. BOOST_FILESYSTEM_DECL
  76. file_status symlink_status(path const& p, system::error_code* ec = 0);
  77. BOOST_FILESYSTEM_DECL
  78. bool is_empty(path const& p, system::error_code* ec = 0);
  79. BOOST_FILESYSTEM_DECL
  80. path initial_path(system::error_code* ec = 0);
  81. BOOST_FILESYSTEM_DECL
  82. path canonical(path const& p, path const& base, system::error_code* ec = 0);
  83. BOOST_FILESYSTEM_DECL
  84. void copy(path const& from, path const& to, unsigned int options, system::error_code* ec = 0);
  85. #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
  86. BOOST_FILESYSTEM_DECL
  87. void copy_directory(path const& from, path const& to, system::error_code* ec = 0);
  88. #endif
  89. BOOST_FILESYSTEM_DECL
  90. bool copy_file(path const& from, path const& to, // See ticket #2925
  91. unsigned int options, system::error_code* ec = 0); // see copy_options for options
  92. BOOST_FILESYSTEM_DECL
  93. void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code* ec = 0);
  94. BOOST_FILESYSTEM_DECL
  95. bool create_directories(path const& p, system::error_code* ec = 0);
  96. BOOST_FILESYSTEM_DECL
  97. bool create_directory(path const& p, const path* existing, system::error_code* ec = 0);
  98. BOOST_FILESYSTEM_DECL
  99. void create_directory_symlink(path const& to, path const& from, system::error_code* ec = 0);
  100. BOOST_FILESYSTEM_DECL
  101. void create_hard_link(path const& to, path const& from, system::error_code* ec = 0);
  102. BOOST_FILESYSTEM_DECL
  103. void create_symlink(path const& to, path const& from, system::error_code* ec = 0);
  104. BOOST_FILESYSTEM_DECL
  105. path current_path(system::error_code* ec = 0);
  106. BOOST_FILESYSTEM_DECL
  107. void current_path(path const& p, system::error_code* ec = 0);
  108. BOOST_FILESYSTEM_DECL
  109. bool equivalent(path const& p1, path const& p2, system::error_code* ec = 0);
  110. BOOST_FILESYSTEM_DECL
  111. boost::uintmax_t file_size(path const& p, system::error_code* ec = 0);
  112. BOOST_FILESYSTEM_DECL
  113. boost::uintmax_t hard_link_count(path const& p, system::error_code* ec = 0);
  114. BOOST_FILESYSTEM_DECL
  115. std::time_t creation_time(path const& p, system::error_code* ec = 0);
  116. BOOST_FILESYSTEM_DECL
  117. std::time_t last_write_time(path const& p, system::error_code* ec = 0);
  118. BOOST_FILESYSTEM_DECL
  119. void last_write_time(path const& p, const std::time_t new_time, system::error_code* ec = 0);
  120. BOOST_FILESYSTEM_DECL
  121. void permissions(path const& p, perms prms, system::error_code* ec = 0);
  122. BOOST_FILESYSTEM_DECL
  123. path read_symlink(path const& p, system::error_code* ec = 0);
  124. BOOST_FILESYSTEM_DECL
  125. path relative(path const& p, path const& base, system::error_code* ec = 0);
  126. BOOST_FILESYSTEM_DECL
  127. bool remove(path const& p, system::error_code* ec = 0);
  128. BOOST_FILESYSTEM_DECL
  129. boost::uintmax_t remove_all(path const& p, system::error_code* ec = 0);
  130. BOOST_FILESYSTEM_DECL
  131. void rename(path const& old_p, path const& new_p, system::error_code* ec = 0);
  132. BOOST_FILESYSTEM_DECL
  133. void resize_file(path const& p, uintmax_t size, system::error_code* ec = 0);
  134. BOOST_FILESYSTEM_DECL
  135. space_info space(path const& p, system::error_code* ec = 0);
  136. BOOST_FILESYSTEM_DECL
  137. path system_complete(path const& p, system::error_code* ec = 0);
  138. BOOST_FILESYSTEM_DECL
  139. path temp_directory_path(system::error_code* ec = 0);
  140. BOOST_FILESYSTEM_DECL
  141. path unique_path(path const& p, system::error_code* ec = 0);
  142. BOOST_FILESYSTEM_DECL
  143. path weakly_canonical(path const& p, path const& base, system::error_code* ec = 0);
  144. } // namespace detail
  145. //--------------------------------------------------------------------------------------//
  146. // //
  147. // status query functions //
  148. // //
  149. //--------------------------------------------------------------------------------------//
  150. inline file_status status(path const& p)
  151. {
  152. return detail::status(p);
  153. }
  154. inline file_status status(path const& p, system::error_code& ec)
  155. {
  156. return detail::status(p, &ec);
  157. }
  158. inline file_status symlink_status(path const& p)
  159. {
  160. return detail::symlink_status(p);
  161. }
  162. inline file_status symlink_status(path const& p, system::error_code& ec)
  163. {
  164. return detail::symlink_status(p, &ec);
  165. }
  166. inline bool exists(path const& p)
  167. {
  168. return exists(detail::status(p));
  169. }
  170. inline bool exists(path const& p, system::error_code& ec)
  171. {
  172. return exists(detail::status(p, &ec));
  173. }
  174. inline bool is_directory(path const& p)
  175. {
  176. return is_directory(detail::status(p));
  177. }
  178. inline bool is_directory(path const& p, system::error_code& ec)
  179. {
  180. return is_directory(detail::status(p, &ec));
  181. }
  182. inline bool is_regular_file(path const& p)
  183. {
  184. return is_regular_file(detail::status(p));
  185. }
  186. inline bool is_regular_file(path const& p, system::error_code& ec)
  187. {
  188. return is_regular_file(detail::status(p, &ec));
  189. }
  190. inline bool is_other(path const& p)
  191. {
  192. return is_other(detail::status(p));
  193. }
  194. inline bool is_other(path const& p, system::error_code& ec)
  195. {
  196. return is_other(detail::status(p, &ec));
  197. }
  198. inline bool is_symlink(path const& p)
  199. {
  200. return is_symlink(detail::symlink_status(p));
  201. }
  202. inline bool is_symlink(path const& p, system::error_code& ec)
  203. {
  204. return is_symlink(detail::symlink_status(p, &ec));
  205. }
  206. #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
  207. inline bool is_regular(path const& p)
  208. {
  209. return is_regular(detail::status(p));
  210. }
  211. inline bool is_regular(path const& p, system::error_code& ec)
  212. {
  213. return is_regular(detail::status(p, &ec));
  214. }
  215. #endif
  216. inline bool is_empty(path const& p)
  217. {
  218. return detail::is_empty(p);
  219. }
  220. inline bool is_empty(path const& p, system::error_code& ec)
  221. {
  222. return detail::is_empty(p, &ec);
  223. }
  224. //--------------------------------------------------------------------------------------//
  225. // //
  226. // operational functions //
  227. // //
  228. //--------------------------------------------------------------------------------------//
  229. inline path initial_path()
  230. {
  231. return detail::initial_path();
  232. }
  233. inline path initial_path(system::error_code& ec)
  234. {
  235. return detail::initial_path(&ec);
  236. }
  237. template< class Path >
  238. path initial_path()
  239. {
  240. return initial_path();
  241. }
  242. template< class Path >
  243. path initial_path(system::error_code& ec)
  244. {
  245. return detail::initial_path(&ec);
  246. }
  247. inline path current_path()
  248. {
  249. return detail::current_path();
  250. }
  251. inline path current_path(system::error_code& ec)
  252. {
  253. return detail::current_path(&ec);
  254. }
  255. inline void current_path(path const& p)
  256. {
  257. detail::current_path(p);
  258. }
  259. inline void current_path(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  260. {
  261. detail::current_path(p, &ec);
  262. }
  263. inline path absolute(path const& p, path const& base = current_path())
  264. {
  265. return detail::absolute(p, base);
  266. }
  267. inline path absolute(path const& p, system::error_code& ec)
  268. {
  269. path base = current_path(ec);
  270. if (ec)
  271. return path();
  272. return detail::absolute(p, base, &ec);
  273. }
  274. inline path absolute(path const& p, path const& base, system::error_code& ec)
  275. {
  276. return detail::absolute(p, base, &ec);
  277. }
  278. inline path canonical(path const& p, path const& base = current_path())
  279. {
  280. return detail::canonical(p, base);
  281. }
  282. inline path canonical(path const& p, system::error_code& ec)
  283. {
  284. path base = current_path(ec);
  285. if (ec)
  286. return path();
  287. return detail::canonical(p, base, &ec);
  288. }
  289. inline path canonical(path const& p, path const& base, system::error_code& ec)
  290. {
  291. return detail::canonical(p, base, &ec);
  292. }
  293. #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
  294. inline path complete(path const& p)
  295. {
  296. return absolute(p, initial_path());
  297. }
  298. inline path complete(path const& p, path const& base)
  299. {
  300. return absolute(p, base);
  301. }
  302. #endif
  303. inline void copy(path const& from, path const& to)
  304. {
  305. detail::copy(from, to, static_cast< unsigned int >(copy_options::none));
  306. }
  307. inline void copy(path const& from, path const& to, system::error_code& ec) BOOST_NOEXCEPT
  308. {
  309. detail::copy(from, to, static_cast< unsigned int >(copy_options::none), &ec);
  310. }
  311. inline void copy(path const& from, path const& to, BOOST_SCOPED_ENUM_NATIVE(copy_options) options)
  312. {
  313. detail::copy(from, to, static_cast< unsigned int >(options));
  314. }
  315. inline void copy(path const& from, path const& to, BOOST_SCOPED_ENUM_NATIVE(copy_options) options, system::error_code& ec) BOOST_NOEXCEPT
  316. {
  317. detail::copy(from, to, static_cast< unsigned int >(options), &ec);
  318. }
  319. #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
  320. inline void copy_directory(path const& from, path const& to)
  321. {
  322. detail::copy_directory(from, to);
  323. }
  324. inline void copy_directory(path const& from, path const& to, system::error_code& ec) BOOST_NOEXCEPT
  325. {
  326. detail::copy_directory(from, to, &ec);
  327. }
  328. #endif
  329. inline bool copy_file(path const& from, path const& to)
  330. {
  331. return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none));
  332. }
  333. inline bool copy_file(path const& from, path const& to, system::error_code& ec) BOOST_NOEXCEPT
  334. {
  335. return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none), &ec);
  336. }
  337. inline bool copy_file(path const& from, path const& to, // See ticket #2925
  338. BOOST_SCOPED_ENUM_NATIVE(copy_options) options)
  339. {
  340. return detail::copy_file(from, to, static_cast< unsigned int >(options));
  341. }
  342. inline bool copy_file(path const& from, path const& to, // See ticket #2925
  343. BOOST_SCOPED_ENUM_NATIVE(copy_options) options, system::error_code& ec) BOOST_NOEXCEPT
  344. {
  345. return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec);
  346. }
  347. #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
  348. inline bool copy_file(path const& from, path const& to, // See ticket #2925
  349. BOOST_SCOPED_ENUM_NATIVE(copy_option) options)
  350. {
  351. return detail::copy_file(from, to, static_cast< unsigned int >(options));
  352. }
  353. inline bool copy_file(path const& from, path const& to, // See ticket #2925
  354. BOOST_SCOPED_ENUM_NATIVE(copy_option) options, system::error_code& ec) BOOST_NOEXCEPT
  355. {
  356. return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec);
  357. }
  358. #endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
  359. inline void copy_symlink(path const& existing_symlink, path const& new_symlink)
  360. {
  361. detail::copy_symlink(existing_symlink, new_symlink);
  362. }
  363. inline void copy_symlink(path const& existing_symlink, path const& new_symlink, system::error_code& ec) BOOST_NOEXCEPT
  364. {
  365. detail::copy_symlink(existing_symlink, new_symlink, &ec);
  366. }
  367. inline bool create_directories(path const& p)
  368. {
  369. return detail::create_directories(p);
  370. }
  371. inline bool create_directories(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  372. {
  373. return detail::create_directories(p, &ec);
  374. }
  375. inline bool create_directory(path const& p)
  376. {
  377. return detail::create_directory(p, 0);
  378. }
  379. inline bool create_directory(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  380. {
  381. return detail::create_directory(p, 0, &ec);
  382. }
  383. inline bool create_directory(path const& p, path const& existing)
  384. {
  385. return detail::create_directory(p, &existing);
  386. }
  387. inline bool create_directory(path const& p, path const& existing, system::error_code& ec) BOOST_NOEXCEPT
  388. {
  389. return detail::create_directory(p, &existing, &ec);
  390. }
  391. inline void create_directory_symlink(path const& to, path const& from)
  392. {
  393. detail::create_directory_symlink(to, from);
  394. }
  395. inline void create_directory_symlink(path const& to, path const& from, system::error_code& ec) BOOST_NOEXCEPT
  396. {
  397. detail::create_directory_symlink(to, from, &ec);
  398. }
  399. inline void create_hard_link(path const& to, path const& new_hard_link)
  400. {
  401. detail::create_hard_link(to, new_hard_link);
  402. }
  403. inline void create_hard_link(path const& to, path const& new_hard_link, system::error_code& ec) BOOST_NOEXCEPT
  404. {
  405. detail::create_hard_link(to, new_hard_link, &ec);
  406. }
  407. inline void create_symlink(path const& to, path const& new_symlink)
  408. {
  409. detail::create_symlink(to, new_symlink);
  410. }
  411. inline void create_symlink(path const& to, path const& new_symlink, system::error_code& ec) BOOST_NOEXCEPT
  412. {
  413. detail::create_symlink(to, new_symlink, &ec);
  414. }
  415. inline bool equivalent(path const& p1, path const& p2)
  416. {
  417. return detail::equivalent(p1, p2);
  418. }
  419. inline bool equivalent(path const& p1, path const& p2, system::error_code& ec) BOOST_NOEXCEPT
  420. {
  421. return detail::equivalent(p1, p2, &ec);
  422. }
  423. inline boost::uintmax_t file_size(path const& p)
  424. {
  425. return detail::file_size(p);
  426. }
  427. inline boost::uintmax_t file_size(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  428. {
  429. return detail::file_size(p, &ec);
  430. }
  431. inline boost::uintmax_t hard_link_count(path const& p)
  432. {
  433. return detail::hard_link_count(p);
  434. }
  435. inline boost::uintmax_t hard_link_count(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  436. {
  437. return detail::hard_link_count(p, &ec);
  438. }
  439. inline std::time_t creation_time(path const& p)
  440. {
  441. return detail::creation_time(p);
  442. }
  443. inline std::time_t creation_time(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  444. {
  445. return detail::creation_time(p, &ec);
  446. }
  447. inline std::time_t last_write_time(path const& p)
  448. {
  449. return detail::last_write_time(p);
  450. }
  451. inline std::time_t last_write_time(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  452. {
  453. return detail::last_write_time(p, &ec);
  454. }
  455. inline void last_write_time(path const& p, const std::time_t new_time)
  456. {
  457. detail::last_write_time(p, new_time);
  458. }
  459. inline void last_write_time(path const& p, const std::time_t new_time, system::error_code& ec) BOOST_NOEXCEPT
  460. {
  461. detail::last_write_time(p, new_time, &ec);
  462. }
  463. inline void permissions(path const& p, perms prms)
  464. {
  465. detail::permissions(p, prms);
  466. }
  467. inline void permissions(path const& p, perms prms, system::error_code& ec) BOOST_NOEXCEPT
  468. {
  469. detail::permissions(p, prms, &ec);
  470. }
  471. inline path read_symlink(path const& p)
  472. {
  473. return detail::read_symlink(p);
  474. }
  475. inline path read_symlink(path const& p, system::error_code& ec)
  476. {
  477. return detail::read_symlink(p, &ec);
  478. }
  479. inline bool remove(path const& p)
  480. {
  481. return detail::remove(p);
  482. }
  483. inline bool remove(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  484. {
  485. return detail::remove(p, &ec);
  486. }
  487. inline boost::uintmax_t remove_all(path const& p)
  488. {
  489. return detail::remove_all(p);
  490. }
  491. inline boost::uintmax_t remove_all(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  492. {
  493. return detail::remove_all(p, &ec);
  494. }
  495. inline void rename(path const& old_p, path const& new_p)
  496. {
  497. detail::rename(old_p, new_p);
  498. }
  499. inline void rename(path const& old_p, path const& new_p, system::error_code& ec) BOOST_NOEXCEPT
  500. {
  501. detail::rename(old_p, new_p, &ec);
  502. }
  503. // name suggested by Scott McMurray
  504. inline void resize_file(path const& p, uintmax_t size)
  505. {
  506. detail::resize_file(p, size);
  507. }
  508. inline void resize_file(path const& p, uintmax_t size, system::error_code& ec) BOOST_NOEXCEPT
  509. {
  510. detail::resize_file(p, size, &ec);
  511. }
  512. inline path relative(path const& p, path const& base = current_path())
  513. {
  514. return detail::relative(p, base);
  515. }
  516. inline path relative(path const& p, system::error_code& ec)
  517. {
  518. path base = current_path(ec);
  519. if (ec)
  520. return path();
  521. return detail::relative(p, base, &ec);
  522. }
  523. inline path relative(path const& p, path const& base, system::error_code& ec)
  524. {
  525. return detail::relative(p, base, &ec);
  526. }
  527. inline space_info space(path const& p)
  528. {
  529. return detail::space(p);
  530. }
  531. inline space_info space(path const& p, system::error_code& ec) BOOST_NOEXCEPT
  532. {
  533. return detail::space(p, &ec);
  534. }
  535. #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
  536. inline bool symbolic_link_exists(path const& p)
  537. {
  538. return is_symlink(filesystem::symlink_status(p));
  539. }
  540. #endif
  541. inline path system_complete(path const& p)
  542. {
  543. return detail::system_complete(p);
  544. }
  545. inline path system_complete(path const& p, system::error_code& ec)
  546. {
  547. return detail::system_complete(p, &ec);
  548. }
  549. inline path temp_directory_path()
  550. {
  551. return detail::temp_directory_path();
  552. }
  553. inline path temp_directory_path(system::error_code& ec)
  554. {
  555. return detail::temp_directory_path(&ec);
  556. }
  557. inline path unique_path(path const& p = "%%%%-%%%%-%%%%-%%%%")
  558. {
  559. return detail::unique_path(p);
  560. }
  561. inline path unique_path(path const& p, system::error_code& ec)
  562. {
  563. return detail::unique_path(p, &ec);
  564. }
  565. inline path weakly_canonical(path const& p, path const& base = current_path())
  566. {
  567. return detail::weakly_canonical(p, base);
  568. }
  569. inline path weakly_canonical(path const& p, system::error_code& ec)
  570. {
  571. path base = current_path(ec);
  572. if (ec)
  573. return path();
  574. return detail::weakly_canonical(p, base, &ec);
  575. }
  576. inline path weakly_canonical(path const& p, path const& base, system::error_code& ec)
  577. {
  578. return detail::weakly_canonical(p, base, &ec);
  579. }
  580. // test helper -----------------------------------------------------------------------//
  581. // Not part of the documented interface since false positives are possible;
  582. // there is no law that says that an OS that has large stat.st_size
  583. // actually supports large file sizes.
  584. namespace detail {
  585. BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
  586. } // namespace detail
  587. } // namespace filesystem
  588. } // namespace boost
  589. #include <boost/filesystem/detail/footer.hpp>
  590. #endif // BOOST_FILESYSTEM_OPERATIONS_HPP