Skip to content

Commit

Permalink
Remove compile_commands.json before writing it
Browse files Browse the repository at this point in the history
This fix existing as a symlink to a cmake directory seems like a pretty
common use case, and the error when it fails to write is pretty
inscrutable.

Fixes hedronvision#105
  • Loading branch information
keith committed May 30, 2024
1 parent a14ad3a commit e5658bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions refresh.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,11 @@ def main():
There should be actionable warnings, above, that led to this.""")
sys.exit(1)

try:
os.remove('compile_commands.json')
except FileNotFoundError:
pass

# Chain output into compile_commands.json
with open('compile_commands.json', 'w') as output_file:
json.dump(
Expand Down

0 comments on commit e5658bc

Please sign in to comment.