1
0
mirror of https://github.com/myhdl/myhdl.git synced 2024-12-14 07:44:38 +08:00

Changed backup vcd filename creation

When there is already a vcd file with the same name, do not just append the timestamp to the filename, but remove the '.vcd' extension, append the timestamp and append the .vcd extension again, so that file will always have the right file extension (very useful for windows systems)
This commit is contained in:
Marcel Hellwig 2017-05-23 10:43:12 +02:00 committed by GitHub
parent 29069ae477
commit 8dc6f96cef

View File

@ -122,7 +122,7 @@ class _TraceSignalsClass(object):
vcdpath = os.path.join(directory, filename + ".vcd")
if path.exists(vcdpath):
backup = vcdpath + '.' + str(path.getmtime(vcdpath))
backup = vcdpath[:-4] + '.' + str(path.getmtime(vcdpath)) + '.vcd'
shutil.copyfile(vcdpath, backup)
os.remove(vcdpath)
vcdfile = open(vcdpath, 'w')