diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2021-10-26 21:04:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-10-26 21:04:02 +0100 |
| commit | 8868bcf57a288a6b210b46ad9755d6dcba6c5712 (patch) | |
| tree | 80df59b4d50c302e0e977f9103d8be5a4eae5172 /src/main.cpp | |
| parent | 9e754cb0f1a08112e265d7270bb71d5372326793 (diff) | |
| parent | 6399f2b0146c4d91b948b09c2b180b42996fdb88 (diff) | |
Merge pull request #1234 from Skytrias/master
fix strip-semicolon using original file handle size
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp index 8c6fb90af..92e541384 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2144,8 +2144,8 @@ int strip_semicolons(Parser *parser) { generated_count += 1; i64 written = 0; - defer (gb_file_truncate(&f, written)); - + defer (err = gb_file_truncate(&f, written)); + debugf("Write file with stripped tokens: %s\n", filename); err = write_file_with_stripped_tokens(&f, file->file, &written); if (err) { @@ -2181,6 +2181,7 @@ int strip_semicolons(Parser *parser) { } debugf("Copy '%s' to '%s'\n", new_fullpath, old_fullpath); + if (!gb_file_copy(new_fullpath, old_fullpath, false)) { gb_printf_err("failed to copy '%s' to '%s'\n", old_fullpath, new_fullpath); debugf("Copy '%s' to '%s'\n", old_fullpath_backup, old_fullpath); @@ -2190,7 +2191,7 @@ int strip_semicolons(Parser *parser) { failed = true; break; } - + debugf("Remove '%s'\n", old_fullpath_backup); if (!gb_file_remove(old_fullpath_backup)) { gb_printf_err("failed to remove '%s'\n", old_fullpath_backup); |