Revert fix for #10149, it caused an unexpected appveyor failure

This commit is contained in:
Daniel Marjamäki 2021-01-30 15:01:19 +01:00
parent b7ce2a5a99
commit 95e2eebd8a
2 changed files with 10 additions and 2 deletions

View File

@ -424,7 +424,15 @@ void ImportProject::importCompileCommands(std::istream &istr)
continue; continue;
struct FileSettings fs; 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* fs.parseCommand(command); // read settings; -D, -I, -U, -std, -m*, -f*
std::map<std::string, std::string, cppcheck::stricmp> variables; std::map<std::string, std::string, cppcheck::stricmp> variables;
fs.setIncludePaths(directory, fs.includePaths, variables); fs.setIncludePaths(directory, fs.includePaths, variables);

View File

@ -19,7 +19,7 @@ def realpath(s):
def create_compile_commands(): def create_compile_commands():
j = [{'directory': realpath('proj2/a'), 'command': 'gcc -c a.c', 'file': 'a.c'}, 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 = open('proj2/' + COMPILE_COMMANDS_JSON, 'wt')
f.write(json.dumps(j)) f.write(json.dumps(j))