Skip to content

Commit

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

def path(s):
def check_path(s):
source = s
# replace env
for key, value in env.items():
Expand All @@ -27,7 +27,7 @@ def path(s):
if s == '':
s = '.'
print('Check', source, '->', s)
return s
assert os.path.exists(s)

# linux, macos or windows:
platform = platform.system().lower()
Expand All @@ -48,12 +48,13 @@ def path(s):
print('Check configuration', configuration['name'])

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

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

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

assert os.path.exists(path(configuration.get('compilerPath', '~'))), configuration.get('compilerPath')
if 'compilerPath' in configuration:
check_path(configuration['compilerPath'])

0 comments on commit 87c9fcf

Please sign in to comment.