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