From 95e2eebd8a9dcae8041f1ed32f8cf793660b67f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 30 Jan 2021 15:01:19 +0100 Subject: [PATCH] Revert fix for #10149, it caused an unexpected appveyor failure --- lib/importproject.cpp | 10 +++++++++- test/cli/test-proj2.py | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/importproject.cpp b/lib/importproject.cpp index 72e683559..146456684 100644 --- a/lib/importproject.cpp +++ b/lib/importproject.cpp @@ -424,7 +424,15 @@ void ImportProject::importCompileCommands(std::istream &istr) continue; struct FileSettings fs; - fs.filename = Path::simplifyPath(directory + file); + if (Path::isAbsolute(file) || Path::fileExists(file)) + fs.filename = file; + else { + std::string path = directory; + if (!path.empty() && !endsWith(path,'/')) + path += '/'; + path += file; + fs.filename = Path::simplifyPath(path); + } fs.parseCommand(command); // read settings; -D, -I, -U, -std, -m*, -f* std::map variables; fs.setIncludePaths(directory, fs.includePaths, variables); diff --git a/test/cli/test-proj2.py b/test/cli/test-proj2.py index 63495690d..3918bf404 100644 --- a/test/cli/test-proj2.py +++ b/test/cli/test-proj2.py @@ -19,7 +19,7 @@ def realpath(s): def create_compile_commands(): j = [{'directory': realpath('proj2/a'), 'command': 'gcc -c a.c', 'file': 'a.c'}, - {'directory': realpath('proj2'), 'command': 'gcc -c b/b.c', 'file': 'b/b.c'}] + {'directory': realpath('proj2/b'), 'command': 'gcc -c b.c', 'file': 'b.c'}] f = open('proj2/' + COMPILE_COMMANDS_JSON, 'wt') f.write(json.dumps(j))