From 50ab6230932c8b3d38631412dd6258e17ac8d0c9 Mon Sep 17 00:00:00 2001 From: t-sin Date: Tue, 9 Mar 2021 22:57:10 +0900 Subject: [PATCH] Use std::filesystem::weakly_canonical() to avoid filesyste_error --- src/basic/filereader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/basic/filereader.cpp b/src/basic/filereader.cpp index ee1c8f0c..633546d3 100644 --- a/src/basic/filereader.cpp +++ b/src/basic/filereader.cpp @@ -32,7 +32,7 @@ std::pair getFilePath(std::string_view val) { FileReader::FileReader(fs::path cwd) : cwd(std::move(cwd)) {} Source FileReader::loadFile(std::string const& path) { - auto [srcpath, type] = getFilePath(fs::canonical(fs::relative(path, cwd)).string()); + auto [srcpath, type] = getFilePath(fs::weakly_canonical(fs::relative(path, cwd)).string()); Source res{fs::absolute(srcpath), type, ""}; // memo: fs::exists(path,ec) for .mmm file returns file type of "unknown", not "regular" or // "none". to prevent error, need to check specifically not to be "not found"