命名空间
变体 (Variants)
视图 (Views)
操作 (Actions)

std::filesystem::copy_symlink

来自 cppreference.cn
 
 
 
定义于头文件 <filesystem>
void copy_symlink( const std::filesystem::path& from,
                   const std::filesystem::path& to);
(1) (since C++17)
void copy_symlink( const std::filesystem::path& from,

                   const std::filesystem::path& to,

                   std::error_code& ec ) noexcept;
(2) (since C++17)

将符号链接复制到另一个位置。

1) 实际效果等同于调用 f(read_symlink(from), to),其中 fcreate_symlinkcreate_directory_symlink,取决于 from 解析为文件还是目录。
2) 实际效果等同于调用 f(read_symlink(from, ec), to, ec),其中 fcreate_symlinkcreate_directory_symlink,取决于 from 解析为文件还是目录。

目录 (Contents)

[编辑] 参数 (Parameters)

from - 要复制的符号链接的路径
to - 新符号链接的目标路径
ec - 在非抛出重载中用于错误报告的输出参数

[编辑] 返回值 (Return value)

(无)

[编辑] 异常 (Exceptions)

任何未标记为 noexcept 的重载都可能在内存分配失败时抛出 std::bad_alloc

1) 在底层操作系统 API 错误时,抛出 std::filesystem::filesystem_error,并使用 from 作为第一个路径参数,to 作为第二个路径参数,以及操作系统错误代码作为错误代码参数构造。
2) 如果操作系统 API 调用失败,则将 std::error_code& 参数设置为操作系统 API 错误代码;如果没有错误发生,则执行 ec.clear()

[编辑] 示例 (Example)

[编辑] 参见 (See also)

(C++17)
复制文件或目录
(函数) (function) [编辑]
(C++17)
复制文件内容
(函数) (function) [编辑]
创建符号链接
(函数) (function) [编辑]
获取符号链接的目标
(函数) (function) [编辑]