Skip to content

Commit 95e2eeb

Browse files
committed
Revert fix for #10149, it caused an unexpected appveyor failure
1 parent b7ce2a5 commit 95e2eeb

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/importproject.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,15 @@ void ImportProject::importCompileCommands(std::istream &istr)
424424
continue;
425425

426426
struct FileSettings fs;
427-
fs.filename = Path::simplifyPath(directory + file);
427+
if (Path::isAbsolute(file) || Path::fileExists(file))
428+
fs.filename = file;
429+
else {
430+
std::string path = directory;
431+
if (!path.empty() && !endsWith(path,'/'))
432+
path += '/';
433+
path += file;
434+
fs.filename = Path::simplifyPath(path);
435+
}
428436
fs.parseCommand(command); // read settings; -D, -I, -U, -std, -m*, -f*
429437
std::map<std::string, std::string, cppcheck::stricmp> variables;
430438
fs.setIncludePaths(directory, fs.includePaths, variables);

test/cli/test-proj2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def realpath(s):
1919

2020
def create_compile_commands():
2121
j = [{'directory': realpath('proj2/a'), 'command': 'gcc -c a.c', 'file': 'a.c'},
22-
{'directory': realpath('proj2'), 'command': 'gcc -c b/b.c', 'file': 'b/b.c'}]
22+
{'directory': realpath('proj2/b'), 'command': 'gcc -c b.c', 'file': 'b.c'}]
2323
f = open('proj2/' + COMPILE_COMMANDS_JSON, 'wt')
2424
f.write(json.dumps(j))
2525

0 commit comments

Comments
 (0)