Skip to content

Commit

Permalink
Make c_cpp_properties.json checker more verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
okalachev committed Jun 11, 2024
1 parent b610ff2 commit 8f1f59c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions tools/check_c_cpp_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
env = props.get('env', {})
env['workspaceFolder'] = '.'

def abspath(s):
def path(s):
source = s
# replace env
for key, value in env.items():
s = s.replace('${' + key + '}', value)
Expand All @@ -25,6 +26,7 @@ def abspath(s):
s = os.path.expanduser(s)
if s == '':
s = '.'
print('Check', source, '->', s)
return s

# linux, macos or windows:
Expand All @@ -40,18 +42,18 @@ def abspath(s):

for configuration in props['configurations']:
if platform not in configuration['name'].lower():
print('Skip', configuration['name'])
print('Skip configuration', configuration['name'])
continue

print('Check configuration', configuration['name'])

for include_path in configuration.get('includePath', []):
assert os.path.exists(abspath(include_path)), include_path
assert os.path.exists(path(include_path)), include_path

for forced_include in configuration.get('forcedInclude', []):
assert os.path.exists(abspath(forced_include)), forced_include
assert os.path.exists(path(forced_include)), forced_include

for browse in configuration.get('browse', {}).get('path', []):
assert os.path.exists(abspath(browse)), browse
assert os.path.exists(path(browse)), browse

assert os.path.exists(abspath(configuration.get('compilerPath', '~'))), configuration.get('compilerPath')
assert os.path.exists(path(configuration.get('compilerPath', '~'))), configuration.get('compilerPath')

0 comments on commit 8f1f59c

Please sign in to comment.