Merge pull request #6909 from andrethomas/patch-2

rename-firmware.py: Bugfix
This commit is contained in:
Theo Arends 2019-11-11 21:23:47 +01:00 committed by GitHub
commit 68c13aee74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,9 @@ import os
def obj_ren_after_bin(source, target, env):
# print("Rename firmware.bin")
base_dir = os.path.dirname(str(target[0]))
os.rename(str(target[0]), "{}{}{}.bin".format(base_dir, os.path.sep, str(target[0]).split(os.path.sep)[1]))
new_file = "{}{}{}.bin".format(base_dir, os.path.sep, str(target[0]).split(os.path.sep)[1])
if os.path.isfile(new_file):
os.remove(new_file)
os.rename(str(target[0]), new_file)
env.AddPostAction("$BUILD_DIR/${PROGNAME}.bin", [obj_ren_after_bin])