c++ - 删除 .. 在 boost filesystem::complete

标签 c++ boost file-io

这应该很简单:我正在使用 boost 文件系统编写绝对路径,但它返回的路径非常丑陋:

D:/Projects/SomeDir/vc10/../resource/plugins/SomeFile.dll

是否有自动处理 .'s 和 ..'s 的 boost 方法?

我所做的是:

boost::filesystem::complete("../resource/plugins/SomeFile.dll")

它使用 boost::filesystem2。

最佳答案

boost::filesystem::complete("../resource/plugins/SomeFile.dll").normalize()

关于c++ - 删除 .. 在 boost filesystem::complete,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5874824/

相关文章:

c++ - Memory SPIKE - boost ASIO 异步读取

c++ - 将 make_iterator_range 与 std::string 一起使用

C++ ofstream 相当于 Win32 CreateFile with CREATE_NEW

c++ - 这有多危险? (List<T> 被转换为 List<const T>)

c++ - 如何在 Visual Studio Community 2015 中在 Windows 上编译 PortAudio?

c++ - 如何编写用于html解析的正则表达式?

java - 用偶数和奇数分隔文件中的行

c++ - 为什么当我用 Rcpp 编写时我不需要包含一些我应该包含在纯 C++ 中编写的库?

c++ operator += 重载返回引用

C++动态数组和文件读取不能一起工作