From 25142fc3b57ebd6acbd96325ed57c6e729433e36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Tue, 4 Sep 2018 16:21:06 +0200 Subject: [PATCH] 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. --- generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator.py b/generator.py index abef9f4f2..b25433749 100755 --- a/generator.py +++ b/generator.py @@ -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: