common: use non-throwing std::filesystem::equivalent()
This commit is contained in:
parent
ebe157cb43
commit
3b3802faf7
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include <limits.h>
|
||||
#include <system_error>
|
||||
|
||||
#include <fmt/core.h>
|
||||
|
||||
|
|
@ -1532,9 +1533,10 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
std::error_code ec;
|
||||
if (!exists(basedir)) {
|
||||
logging::print("WARNING: failed to find basedir '{}'\n", basedir);
|
||||
} else if (!equivalent(gamedir, basedir)) {
|
||||
} else if (!equivalent(gamedir, basedir, ec)) {
|
||||
addArchive(basedir);
|
||||
logging::print("using basedir: '{}'\n", basedir);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <array>
|
||||
#include <list>
|
||||
#include <stdexcept>
|
||||
#include <system_error>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace fs
|
||||
|
|
@ -246,7 +247,8 @@ inline std::shared_ptr<archive_like> addArchiveInternal(const path &p, bool exte
|
|||
{
|
||||
if (is_directory(p)) {
|
||||
for (auto &dir : directories) {
|
||||
if (equivalent(dir->pathname, p)) {
|
||||
std::error_code ec;
|
||||
if (equivalent(dir->pathname, p, ec)) {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
|
@ -256,7 +258,8 @@ inline std::shared_ptr<archive_like> addArchiveInternal(const path &p, bool exte
|
|||
return arch;
|
||||
} else {
|
||||
for (auto &arch : archives) {
|
||||
if (equivalent(arch->pathname, p)) {
|
||||
std::error_code ec;
|
||||
if (equivalent(arch->pathname, p, ec)) {
|
||||
return arch;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue