generator.py: change heuristic to modify Cargo.toml

It is easy to forget to add the final comma in the last item in
the workspace member list, thus the current heuristic breaks the
Cargo.toml parsing.

Instead of trying to append the gir item, it is inserted at
position end-2, avoiding the previous described situation.
This commit is contained in:
Víctor Manuel Jáquez Leal 2018-09-04 16:21:06 +02:00 committed by Sebastian Dröge
parent d9078774c3
commit 25142fc3b5

View file

@ -12,7 +12,7 @@ def update_workspace():
old_lines = f.readlines()
lines = old_lines[:]
with open('Cargo.toml', 'w') as f:
lines.insert(len(lines) - 1, '"gir",')
lines.insert(len(lines) - 2, '"gir",')
f.write(''.join(lines))
success = True
try: