blob: 02ae98c16f7d5f8835e93d080db970de65a83b13 [file] [log] [blame]
Ed Tanousd44b4442017-02-28 11:12:44 -08001import json
2import shlex
3import os
4import sys
5
6SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
7
8VS_CODE_FILE = os.path.join(SCRIPT_DIR, "../.vscode/c_cpp_properties.json")
9
10def main():
11 """ Main function"""
12 if os.path.exists(VS_CODE_FILE):
13 unique_includes = list(set(sys.argv[1:]))
14
15 print("Adding {} includes to c_cpp_properties.json".format(len(unique_includes)))
16 with open(VS_CODE_FILE) as vscodefile:
17 vscode_data = json.load(vscodefile)
18
19 for config in vscode_data["configurations"]:
20 if config["name"] in "Linux":
21 config["includePath"] = unique_includes
22
23
24 with open(VS_CODE_FILE, 'w') as vscodefile:
25 json.dump(vscode_data, vscodefile, sort_keys=True, indent=4)
26
27if __name__ == "__main__":
28 main()