这行指令出来会出来大小写的盘符,如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;
}