std::filesy...copy_symlink(3)
π NAME π
std::filesystem::copy_symlink β okay so this is the function that copies a symlink to another location π
. Youβre reading the C++ Standard Libary manual page for it, bestie β¨ (yes, thatβs the manual name, keep it cute).
β¨ Synopsis β¨
Defined in header <filesystem>
void copy_symlink( const std::filesystem::path& from, (1) (since C++17)
const std::filesystem::path& to);
void copy_symlink( const std::filesystem::path& from,
const std::filesystem::path& to, (2) (since C++17)
std::error_code& ec ) noexcept;
Copies a symlink to another location. Like, the whole vibe is: point at a symlink, make another symlink in a new spot πΈ.
Hereβs the tea on the overloads:
- Overload (1) effectively calls
f(read_symlink(from), to)wherefiscreate_symlinkorcreate_directory_symlink, depending on whetherfromresolves to a file or directory. Periodt. - Overload (2) effectively calls
f(read_symlink(from, ec), to, ec)wherefiscreate_symlinkorcreate_directory_symlink, depending on whetherfromresolves to a file or directory. Same energy, but with theecout-parameter π«.
π«Ά Parameters π«Ά
fromβ path to a symbolic link to copy. The original symlink bestie.toβ destination path of the new symlink. Where the copy lands.ecβ out-parameter for error reporting in the non-throwing overload. Your error-code bestie for overload (2).
π« Return value π«
(none) β yep, it returns literally nothing. Itβs giving βdo the thing and dipβ π .
π Exceptions π
Any overload not marked noexcept may throw std::bad_alloc if memory allocation fails. No cap, memory is a thing π.
- Throws
std::filesystem::filesystem_erroron underlying OS API errors, constructed withfromas the first path argument,toas the second path argument, and the OS error code as the error code argument. So if the OS says nope, this is the dramatic throw π. - Sets a
std::error_code¶meter to the OS API error code if an OS API call fails, and executesec.clear()if no errors occur. Chill overload behavior π«Ά.
πΈ Example πΈ
This section is incomplete. Reason: no example. Not me leaving the example section empty π β the page literally says itβs incomplete, and the reason is no example.
π See also π
copyβ copies files or directories(C++17)(function)copy_fileβ copies file contents(C++17)(function)create_symlinkβ(C++17)(function)create_directory_symlinkβ creates a symbolic link(C++17)(function)read_symlinkβ obtains the target of a symbolic link(C++17)(function)
π Category π
Todo no example
made with π from source http://cppreference.com, version/date 2024.06.10 β page std::filesy...copy_symlink(3) β mwah, bestie πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms