如何将boost :: filesystem :: path与“..”(go up)组件转换为正确的路径

问题描述 投票:1回答:3

如何以下列形式转换boost :: filesystem :: path:

根/ subdir1 / subdir2 /../ some.file

至:

根/ subdir1 / some.file

可能有多个“升级”操作员?

c++ boost boost-filesystem
3个回答
1
投票

查看Boost文件系统库中的canonical


1
投票

简短的问题,简短的回答:

通过随后简单地擦除路径中的每个qazxsw poi事件。您可以轻松地使用正则表达式。


0
投票

为什么不使用branch_path()?它返回boost :: filesystem :: path的父目录

例:

/<dirname>/..

您可以随意使用它。

© www.soinside.com 2019 - 2024. All rights reserved.