diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-14 13:11:55 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-08-14 13:11:55 +0200 |
commit | 1e2e28d3e442ba3c95a5c2b9e5d920c72f6cee43 (patch) | |
tree | 38a998f6769a3898d440ccbe122611c1eb7e59c5 /libbutl/filesystem.mxx | |
parent | d20d2a641351b7f9e8c9bd9b841d8de4d824aa82 (diff) |
Add mkanylink() filesystem function
Diffstat (limited to 'libbutl/filesystem.mxx')
-rw-r--r-- | libbutl/filesystem.mxx | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libbutl/filesystem.mxx b/libbutl/filesystem.mxx index 2e3a0d9..e028975 100644 --- a/libbutl/filesystem.mxx +++ b/libbutl/filesystem.mxx @@ -289,8 +289,8 @@ LIBBUTL_MODEXPORT namespace butl // Create a hard link to a file (default) or directory (third argument is // true). Throw std::system_error on failures. // - // Note that on Linix, FreeBSD, Windows and some other platforms the target - // can not be a directory. + // Note that on Linux, FreeBSD, Windows and some other platforms the target + // cannot be a directory. // LIBBUTL_SYMEXPORT void mkhardlink (const path& target, const path& link, bool dir = false); @@ -303,6 +303,23 @@ LIBBUTL_MODEXPORT namespace butl mkhardlink (target, link, true /* dir */); } + // Make a symlink, hardlink, or, if `copy` is true, a copy of a file (note: + // no directories, only files), whichever is possible in that order. If + // `relative` is true, then make the symlink target relative to the link + // directory (note: it is the caller's responsibility to make sure this is + // possible). + // + // On success, return the type of entry created: `regular` for copy, + // `symlink` for symlink, and `other` for hardlink. On failure, throw a + // `pair<entry_type, system_error>` with the first half indicating the part + // of the logic that caused the error. + // + LIBBUTL_SYMEXPORT entry_type + mkanylink (const path& target, + const path& link, + bool copy, + bool relative = false); + // File copy flags. // enum class cpflags: std::uint16_t |