std::filesystem::current_path.generic_string的bug

这行指令出来会出来大小写的盘符,如D 或者d,似乎随机

#include <iostream>
#include <filesystem>
 
namespace fs = std::filesystem;
 
bool arePathsSame(const fs::path& p1, const fs::path& p2) {
    return p1 == p2;
}
 
int main() {
    fs::path path1 = "/home/user/file.txt";
    fs::path path2 = "/home/user/file.txt";
 
    if (arePathsSame(path1, path2)) {
        std::cout << "The paths are the same." << std::endl;
    } else {
        std::cout << "The paths are different." << std::endl;
    }
 
    return 0;
}

std::filesystem::equivalent - cppreference.com

上一篇:mysql索引优化


下一篇:我的自白书之简历