Fixed #10149 (compile database; incomplete handling of directory and file)
This commit is contained in:
parent
9e9bb9f804
commit
43e8430a80
|
@ -424,15 +424,7 @@ void ImportProject::importCompileCommands(std::istream &istr)
|
|||
continue;
|
||||
|
||||
struct FileSettings fs;
|
||||
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.filename = Path::simplifyPath(directory + file);
|
||||
fs.parseCommand(command); // read settings; -D, -I, -U, -std, -m*, -f*
|
||||
std::map<std::string, std::string, cppcheck::stricmp> variables;
|
||||
fs.setIncludePaths(directory, fs.includePaths, variables);
|
||||
|
|
|
@ -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/b'), 'command': 'gcc -c b.c', 'file': 'b.c'}]
|
||||
{'directory': realpath('proj2'), 'command': 'gcc -c b/b.c', 'file': 'b/b.c'}]
|
||||
f = open('proj2/' + COMPILE_COMMANDS_JSON, 'wt')
|
||||
f.write(json.dumps(j))
|
||||
|
||||
|
|
Loading…
Reference in New Issue