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