std::filesystem::path 有几种
dir/file.txt或dir\file.txt无cwd的路径片段.is_relative() == true.is_absolute() == false
./file1或.\file1相对当前目录的相对路径 (当前目录.).is_relative() == true.is_absolute() == false
/root/file1或C:\\Windows绝对路径
Win special
c:或C::is_relative() == truec:\或C:/:is_absolute() == true
std::filesystem::lexically_xx() lexically系列
‘lexically’ 字面上转换, 直接转换, 不论文件是否存在, 例如这个例子 https://en.cppreference.com/w/cpp/filesystem/canonical
std::filesystem::canonical()如果路径存在返回, 否则 exception / error_codestd::filesystem::weakly_canonical()不校验路径是否存在, 直接计算路径for example Current path is "/tmp/a/b/c1/d"
- canonical("../../c2/./e") == "/tmp/a/b/c2/e"
- weakly_canonical("../no-such-file") == "/tmp/a/b/c1/no-such-file"
- caronical("../no-such-file") => threw exception: filesystem error: in canonical: No such file or directory [../no-such-file] [/tmp/a/b/c1/d]
路径转换
- ABS绝对路径
absolute() - ABS绝对路径
canonical() - REL相对路径
proximate() - REL相对路径
relative() - 路径转换到 OS-perferred-sep
lexically_normal()
2025年10月新盘 做第一批吃螃蟹的人coinsrore.com
新车新盘 嘎嘎稳 嘎嘎靠谱coinsrore.com
新车首发,新的一年,只带想赚米的人coinsrore.com
新盘 上车集合 留下 我要发发 立马进裙coinsrore.com
做了几十年的项目 我总结了最好的一个盘(纯干货)coinsrore.com
新车上路,只带前10个人coinsrore.com
新盘首开 新盘首开 征召客户!!!coinsrore.com
新项目准备上线,寻找志同道合 的合作伙伴coinsrore.com
新车即将上线 真正的项目,期待你的参与coinsrore.com
新盘新项目,不再等待,现在就是最佳上车机会!coinsrore.com
新盘新盘 这个月刚上新盘 新车第一个吃螃蟹!coinsrore.com
2025年10月新盘 做第一批吃螃蟹的人coinsrore.com
新车新盘 嘎嘎稳 嘎嘎靠谱coinsrore.com
新车首发,新的一年,只带想赚米的人coinsrore.com
新盘 上车集合 留下 我要发发 立马进裙coinsrore.com
做了几十年的项目 我总结了最好的一个盘(纯干货)coinsrore.com
新车上路,只带前10个人coinsrore.com
新盘首开 新盘首开 征召客户!!!coinsrore.com
新项目准备上线,寻找志同道合 的合作伙伴coinsrore.com
新车即将上线 真正的项目,期待你的参与coinsrore.com
新盘新项目,不再等待,现在就是最佳上车机会!coinsrore.com
新盘新盘 这个月刚上新盘 新车第一个吃螃蟹!coinsrore.com
做了几十年的项目 我总结了最好的一个盘(纯干货)
新车上路,只带前10个人