• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 last_write_time(const path& p, system::error_code* ec=0);
141 BOOST_FILESYSTEM_DECL
142 void last_write_time(const path& p, const std::time_t new_time,
143                      system::error_code* ec=0);
144 BOOST_FILESYSTEM_DECL
145 void permissions(const path& p, perms prms, system::error_code* ec=0);
146 BOOST_FILESYSTEM_DECL
147 path read_symlink(const path& p, system::error_code* ec=0);
148 BOOST_FILESYSTEM_DECL
149 path relative(const path& p, const path& base, system::error_code* ec = 0);
150 BOOST_FILESYSTEM_DECL
151 bool remove(const path& p, system::error_code* ec=0);
152 BOOST_FILESYSTEM_DECL
153 boost::uintmax_t remove_all(const path& p, system::error_code* ec=0);
154 BOOST_FILESYSTEM_DECL
155 void rename(const path& old_p, const path& new_p, system::error_code* ec=0);
156 BOOST_FILESYSTEM_DECL
157 void resize_file(const path& p, uintmax_t size, system::error_code* ec=0);
158 BOOST_FILESYSTEM_DECL
159 space_info space(const path& p, system::error_code* ec=0);
160 BOOST_FILESYSTEM_DECL
161 path system_complete(const path& p, system::error_code* ec=0);
162 BOOST_FILESYSTEM_DECL
163 path temp_directory_path(system::error_code* ec=0);
164 BOOST_FILESYSTEM_DECL
165 path unique_path(const path& p, system::error_code* ec=0);
166 BOOST_FILESYSTEM_DECL
167 path weakly_canonical(const path& p, system::error_code* ec = 0);
168 
169 } // namespace detail
170 
171 //--------------------------------------------------------------------------------------//
172 //                                                                                      //
173 //                             status query functions                                   //
174 //                                                                                      //
175 //--------------------------------------------------------------------------------------//
176 
177 inline
status(const path & p)178 file_status status(const path& p)    {return detail::status(p);}
179 inline
status(const path & p,system::error_code & ec)180 file_status status(const path& p, system::error_code& ec)
181                                      {return detail::status(p, &ec);}
182 inline
symlink_status(const path & p)183 file_status symlink_status(const path& p) {return detail::symlink_status(p);}
184 inline
symlink_status(const path & p,system::error_code & ec)185 file_status symlink_status(const path& p, system::error_code& ec)
186                                      {return detail::symlink_status(p, &ec);}
187 inline
exists(const path & p)188 bool exists(const path& p)           {return exists(detail::status(p));}
189 inline
exists(const path & p,system::error_code & ec)190 bool exists(const path& p, system::error_code& ec)
191                                      {return exists(detail::status(p, &ec));}
192 inline
is_directory(const path & p)193 bool is_directory(const path& p)     {return is_directory(detail::status(p));}
194 inline
is_directory(const path & p,system::error_code & ec)195 bool is_directory(const path& p, system::error_code& ec)
196                                      {return is_directory(detail::status(p, &ec));}
197 inline
is_regular_file(const path & p)198 bool is_regular_file(const path& p)  {return is_regular_file(detail::status(p));}
199 inline
is_regular_file(const path & p,system::error_code & ec)200 bool is_regular_file(const path& p, system::error_code& ec)
201                                      {return is_regular_file(detail::status(p, &ec));}
202 inline
is_other(const path & p)203 bool is_other(const path& p)         {return is_other(detail::status(p));}
204 inline
is_other(const path & p,system::error_code & ec)205 bool is_other(const path& p, system::error_code& ec)
206                                      {return is_other(detail::status(p, &ec));}
207 inline
is_symlink(const path & p)208 bool is_symlink(const path& p)       {return is_symlink(detail::symlink_status(p));}
209 inline
is_symlink(const path & p,system::error_code & ec)210 bool is_symlink(const path& p, system::error_code& ec)
211                                      {return is_symlink(detail::symlink_status(p, &ec));}
212 #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
213 inline
is_regular(const path & p)214 bool is_regular(const path& p)       {return is_regular(detail::status(p));}
215 inline
is_regular(const path & p,system::error_code & ec)216 bool is_regular(const path& p, system::error_code& ec)
217                                      {return is_regular(detail::status(p, &ec));}
218 #endif
219 
220 inline
is_empty(const path & p)221 bool is_empty(const path& p)         {return detail::is_empty(p);}
222 inline
is_empty(const path & p,system::error_code & ec)223 bool is_empty(const path& p, system::error_code& ec)
224                                      {return detail::is_empty(p, &ec);}
225 
226 //--------------------------------------------------------------------------------------//
227 //                                                                                      //
228 //                             operational functions                                    //
229 //                                                                                      //
230 //--------------------------------------------------------------------------------------//
231 
232 inline
initial_path()233 path initial_path()                  {return detail::initial_path();}
234 
235 inline
initial_path(system::error_code & ec)236 path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
237 
238 template <class Path>
initial_path()239 path initial_path() {return initial_path();}
240 template <class Path>
initial_path(system::error_code & ec)241 path initial_path(system::error_code& ec) {return detail::initial_path(&ec);}
242 
243 inline
current_path()244 path current_path()                  {return detail::current_path();}
245 
246 inline
current_path(system::error_code & ec)247 path current_path(system::error_code& ec) {return detail::current_path(&ec);}
248 
249 inline
current_path(const path & p)250 void current_path(const path& p)     {detail::current_path(p);}
251 
252 inline
current_path(const path & p,system::error_code & ec)253 void current_path(const path& p, system::error_code& ec) BOOST_NOEXCEPT {detail::current_path(p, &ec);}
254 
255 inline
absolute(const path & p,const path & base=current_path ())256 path absolute(const path& p, const path& base=current_path()) {return detail::absolute(p, base);}
257 inline
absolute(const path & p,system::error_code & ec)258 path absolute(const path& p, system::error_code& ec)
259 {
260   path base = current_path(ec);
261   if (ec)
262     return path();
263   return detail::absolute(p, base, &ec);
264 }
265 inline
absolute(const path & p,const path & base,system::error_code & ec)266 path absolute(const path& p, const path& base, system::error_code& ec) {return detail::absolute(p, base, &ec);}
267 
268 inline
canonical(const path & p,const path & base=current_path ())269 path canonical(const path& p, const path& base=current_path())
270                                      {return detail::canonical(p, base);}
271 inline
canonical(const path & p,system::error_code & ec)272 path canonical(const path& p, system::error_code& ec)
273 {
274   path base = current_path(ec);
275   if (ec)
276     return path();
277   return detail::canonical(p, base, &ec);
278 }
279 inline
canonical(const path & p,const path & base,system::error_code & ec)280 path canonical(const path& p, const path& base, system::error_code& ec)
281                                      {return detail::canonical(p, base, &ec);}
282 
283 #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
284 inline
complete(const path & p)285 path complete(const path& p)
286 {
287   return absolute(p, initial_path());
288 }
289 
290 inline
complete(const path & p,const path & base)291 path complete(const path& p, const path& base)
292 {
293   return absolute(p, base);
294 }
295 #endif
296 
297 inline
copy(const path & from,const path & to)298 void copy(const path& from, const path& to)
299 {
300   detail::copy(from, to, static_cast< unsigned int >(copy_options::none));
301 }
302 inline
copy(const path & from,const path & to,system::error_code & ec)303 void copy(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT
304 {
305   detail::copy(from, to, static_cast< unsigned int >(copy_options::none), &ec);
306 }
307 inline
copy(const path & from,const path & to,BOOST_SCOPED_ENUM_NATIVE (copy_options)options)308 void copy(const path& from, const path& to, BOOST_SCOPED_ENUM_NATIVE(copy_options) options)
309 {
310   detail::copy(from, to, static_cast< unsigned int >(options));
311 }
312 inline
copy(const path & from,const path & to,BOOST_SCOPED_ENUM_NATIVE (copy_options)options,system::error_code & ec)313 void copy(const path& from, const path& to, BOOST_SCOPED_ENUM_NATIVE(copy_options) options, system::error_code& ec) BOOST_NOEXCEPT
314 {
315   detail::copy(from, to, static_cast< unsigned int >(options), &ec);
316 }
317 
318 #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
319 inline
copy_directory(const path & from,const path & to)320 void copy_directory(const path& from, const path& to)
321                                      {detail::copy_directory(from, to);}
322 inline
copy_directory(const path & from,const path & to,system::error_code & ec)323 void copy_directory(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT
324                                      {detail::copy_directory(from, to, &ec);}
325 #endif
326 inline
copy_file(const path & from,const path & to)327 bool copy_file(const path& from, const path& to)
328 {
329   return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none));
330 }
331 inline
copy_file(const path & from,const path & to,system::error_code & ec)332 bool copy_file(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT
333 {
334   return detail::copy_file(from, to, static_cast< unsigned int >(copy_options::none), &ec);
335 }
336 inline
copy_file(const path & from,const path & to,BOOST_SCOPED_ENUM_NATIVE (copy_options)options)337 bool copy_file(const path& from, const path& 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
copy_file(const path & from,const path & to,BOOST_SCOPED_ENUM_NATIVE (copy_options)options,system::error_code & ec)343 bool copy_file(const path& from, const path& to,   // See ticket #2925
344                BOOST_SCOPED_ENUM_NATIVE(copy_options) options, system::error_code& ec) BOOST_NOEXCEPT
345 {
346   return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec);
347 }
348 #if !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
349 inline
copy_file(const path & from,const path & to,BOOST_SCOPED_ENUM_NATIVE (copy_option)options)350 bool copy_file(const path& from, const path& to,   // See ticket #2925
351                BOOST_SCOPED_ENUM_NATIVE(copy_option) options)
352 {
353   return detail::copy_file(from, to, static_cast< unsigned int >(options));
354 }
355 inline
copy_file(const path & from,const path & to,BOOST_SCOPED_ENUM_NATIVE (copy_option)options,system::error_code & ec)356 bool copy_file(const path& from, const path& to,   // See ticket #2925
357                BOOST_SCOPED_ENUM_NATIVE(copy_option) options, system::error_code& ec) BOOST_NOEXCEPT
358 {
359   return detail::copy_file(from, to, static_cast< unsigned int >(options), &ec);
360 }
361 #endif // !defined(BOOST_FILESYSTEM_NO_DEPRECATED)
362 inline
copy_symlink(const path & existing_symlink,const path & new_symlink)363 void copy_symlink(const path& existing_symlink,
364                   const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);}
365 
366 inline
copy_symlink(const path & existing_symlink,const path & new_symlink,system::error_code & ec)367 void copy_symlink(const path& existing_symlink, const path& new_symlink,
368                   system::error_code& ec) BOOST_NOEXCEPT
369                                      {detail::copy_symlink(existing_symlink, new_symlink, &ec);}
370 inline
create_directories(const path & p)371 bool create_directories(const path& p) {return detail::create_directories(p);}
372 
373 inline
create_directories(const path & p,system::error_code & ec)374 bool create_directories(const path& p, system::error_code& ec) BOOST_NOEXCEPT
375                                      {return detail::create_directories(p, &ec);}
376 inline
create_directory(const path & p)377 bool create_directory(const path& p) {return detail::create_directory(p, 0);}
378 
379 inline
create_directory(const path & p,system::error_code & ec)380 bool create_directory(const path& p, system::error_code& ec) BOOST_NOEXCEPT
381                                      {return detail::create_directory(p, 0, &ec);}
382 inline
create_directory(const path & p,const path & existing)383 bool create_directory(const path& p, const path& existing)
384                                      {return detail::create_directory(p, &existing);}
385 inline
create_directory(const path & p,const path & existing,system::error_code & ec)386 bool create_directory(const path& p, const path& existing, system::error_code& ec) BOOST_NOEXCEPT
387                                      {return detail::create_directory(p, &existing, &ec);}
388 inline
create_directory_symlink(const path & to,const path & from)389 void create_directory_symlink(const path& to, const path& from)
390                                      {detail::create_directory_symlink(to, from);}
391 inline
create_directory_symlink(const path & to,const path & from,system::error_code & ec)392 void create_directory_symlink(const path& to, const path& from, system::error_code& ec) BOOST_NOEXCEPT
393                                      {detail::create_directory_symlink(to, from, &ec);}
394 inline
create_hard_link(const path & to,const path & new_hard_link)395 void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);}
396 
397 inline
create_hard_link(const path & to,const path & new_hard_link,system::error_code & ec)398 void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) BOOST_NOEXCEPT
399                                      {detail::create_hard_link(to, new_hard_link, &ec);}
400 inline
create_symlink(const path & to,const path & new_symlink)401 void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);}
402 
403 inline
create_symlink(const path & to,const path & new_symlink,system::error_code & ec)404 void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) BOOST_NOEXCEPT
405                                      {detail::create_symlink(to, new_symlink, &ec);}
406 inline
equivalent(const path & p1,const path & p2)407 bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);}
408 
409 inline
equivalent(const path & p1,const path & p2,system::error_code & ec)410 bool equivalent(const path& p1, const path& p2, system::error_code& ec) BOOST_NOEXCEPT
411                                      {return detail::equivalent(p1, p2, &ec);}
412 inline
file_size(const path & p)413 boost::uintmax_t file_size(const path& p) {return detail::file_size(p);}
414 
415 inline
file_size(const path & p,system::error_code & ec)416 boost::uintmax_t file_size(const path& p, system::error_code& ec) BOOST_NOEXCEPT
417                                      {return detail::file_size(p, &ec);}
418 inline
hard_link_count(const path & p)419 boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);}
420 
421 inline
hard_link_count(const path & p,system::error_code & ec)422 boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) BOOST_NOEXCEPT
423                                      {return detail::hard_link_count(p, &ec);}
424 inline
last_write_time(const path & p)425 std::time_t last_write_time(const path& p) {return detail::last_write_time(p);}
426 
427 inline
last_write_time(const path & p,system::error_code & ec)428 std::time_t last_write_time(const path& p, system::error_code& ec) BOOST_NOEXCEPT
429                                      {return detail::last_write_time(p, &ec);}
430 inline
last_write_time(const path & p,const std::time_t new_time)431 void last_write_time(const path& p, const std::time_t new_time)
432                                      {detail::last_write_time(p, new_time);}
433 inline
last_write_time(const path & p,const std::time_t new_time,system::error_code & ec)434 void last_write_time(const path& p, const std::time_t new_time,
435                      system::error_code& ec) BOOST_NOEXCEPT
436                                      {detail::last_write_time(p, new_time, &ec);}
437 inline
permissions(const path & p,perms prms)438 void permissions(const path& p, perms prms)
439                                      {detail::permissions(p, prms);}
440 inline
permissions(const path & p,perms prms,system::error_code & ec)441 void permissions(const path& p, perms prms, system::error_code& ec) BOOST_NOEXCEPT
442                                      {detail::permissions(p, prms, &ec);}
443 
444 inline
read_symlink(const path & p)445 path read_symlink(const path& p)     {return detail::read_symlink(p);}
446 
447 inline
read_symlink(const path & p,system::error_code & ec)448 path read_symlink(const path& p, system::error_code& ec)
449                                      {return detail::read_symlink(p, &ec);}
450 
451 inline
remove(const path & p)452 bool remove(const path& p)           {return detail::remove(p);}
453 
454 inline
remove(const path & p,system::error_code & ec)455 bool remove(const path& p, system::error_code& ec) BOOST_NOEXCEPT
456                                      {return detail::remove(p, &ec);}
457 
458 inline
remove_all(const path & p)459 boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);}
460 
461 inline
remove_all(const path & p,system::error_code & ec)462 boost::uintmax_t remove_all(const path& p, system::error_code& ec) BOOST_NOEXCEPT
463                                      {return detail::remove_all(p, &ec);}
464 inline
rename(const path & old_p,const path & new_p)465 void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);}
466 
467 inline
rename(const path & old_p,const path & new_p,system::error_code & ec)468 void rename(const path& old_p, const path& new_p, system::error_code& ec) BOOST_NOEXCEPT
469                                      {detail::rename(old_p, new_p, &ec);}
470 inline  // name suggested by Scott McMurray
resize_file(const path & p,uintmax_t size)471 void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);}
472 
473 inline
resize_file(const path & p,uintmax_t size,system::error_code & ec)474 void resize_file(const path& p, uintmax_t size, system::error_code& ec) BOOST_NOEXCEPT
475                                      {detail::resize_file(p, size, &ec);}
476 inline
relative(const path & p,const path & base=current_path ())477 path relative(const path& p, const path& base=current_path())
478                                      {return detail::relative(p, base);}
479 inline
relative(const path & p,system::error_code & ec)480 path relative(const path& p, system::error_code& ec)
481 {
482   path base = current_path(ec);
483   if (ec)
484     return path();
485   return detail::relative(p, base, &ec);
486 }
487 inline
relative(const path & p,const path & base,system::error_code & ec)488 path relative(const path& p, const path& base, system::error_code& ec)
489                                      {return detail::relative(p, base, &ec);}
490 inline
space(const path & p)491 space_info space(const path& p)      {return detail::space(p);}
492 
493 inline
space(const path & p,system::error_code & ec)494 space_info space(const path& p, system::error_code& ec) BOOST_NOEXCEPT
495                                      {return detail::space(p, &ec);}
496 
497 #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
symbolic_link_exists(const path & p)498 inline bool symbolic_link_exists(const path& p)
499                                      { return is_symlink(filesystem::symlink_status(p)); }
500 #endif
501 
502 inline
system_complete(const path & p)503 path system_complete(const path& p)  {return detail::system_complete(p);}
504 
505 inline
system_complete(const path & p,system::error_code & ec)506 path system_complete(const path& p, system::error_code& ec)
507                                      {return detail::system_complete(p, &ec);}
508 inline
temp_directory_path()509 path temp_directory_path()           {return detail::temp_directory_path();}
510 
511 inline
temp_directory_path(system::error_code & ec)512 path temp_directory_path(system::error_code& ec)
513                                      {return detail::temp_directory_path(&ec);}
514 inline
unique_path(const path & p="%%%%-%%%%-%%%%-%%%%")515 path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%")
516                                      {return detail::unique_path(p);}
517 inline
unique_path(const path & p,system::error_code & ec)518 path unique_path(const path& p, system::error_code& ec)
519                                      {return detail::unique_path(p, &ec);}
520 inline
weakly_canonical(const path & p)521 path weakly_canonical(const path& p)   {return detail::weakly_canonical(p);}
522 
523 inline
weakly_canonical(const path & p,system::error_code & ec)524 path weakly_canonical(const path& p, system::error_code& ec)
525                                      {return detail::weakly_canonical(p, &ec);}
526 
527 //  test helper  -----------------------------------------------------------------------//
528 
529 //  Not part of the documented interface since false positives are possible;
530 //  there is no law that says that an OS that has large stat.st_size
531 //  actually supports large file sizes.
532 
533 namespace detail {
534 
535 BOOST_FILESYSTEM_DECL bool possible_large_file_size_support();
536 
537 } // namespace detail
538 
539 } // namespace filesystem
540 } // namespace boost
541 
542 #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas
543 #endif // BOOST_FILESYSTEM3_OPERATIONS_HPP
544