From fd3a9aad2bcd913ac1830e11670f0a422231e43f Mon Sep 17 00:00:00 2001 From: Hans Loeblich Date: Sun, 3 Nov 2024 07:01:44 -0600 Subject: [PATCH] Fix for #5405 difference between boost and std library treatment of empty path in filesystem::absolute (#5407) --- src/core/parser.y | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/parser.y b/src/core/parser.y index 2b09b6a644..534a088052 100644 --- a/src/core/parser.y +++ b/src/core/parser.y @@ -760,11 +760,11 @@ bool parse(SourceFile *&file, const std::string& text, const std::string &filena { fs::path filepath; try { - filepath = fs::absolute(fs::path(filename)); - mainFilePath = fs::absolute(fs::path(mainFile)); + filepath = filename.empty() ? fs::current_path() : fs::absolute(fs::path{filename}); + mainFilePath = mainFile.empty() ? fs::current_path() : fs::absolute(fs::path{mainFile}); } catch (...) { // yyerror tries to print the file path, which throws again, and we can't do that - LOG(message_group::Error, "Parser error: file access denied"); + LOG(message_group::Error, "Parser error: file access denied"); return false; }