Skip to content

Commit fc97d77

Browse files
committed
Remove file before moving over it
Windows is dumb sometimes
1 parent c2642a1 commit fc97d77

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/memap.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
from abc import abstractmethod, ABCMeta
77
from sys import stdout, exit, argv
8-
from os import sep, rename
8+
from os import sep, rename, remove
99
from os.path import (basename, dirname, join, relpath, abspath, commonprefix,
10-
splitext)
10+
splitext, exists)
1111
import re
1212
import csv
1313
import json
@@ -824,7 +824,10 @@ def parse(self, mapfile, toolchain):
824824
except IOError:
825825
self.old_modules = None
826826
if not COMPARE_FIXED:
827-
rename(mapfile, "%s.old" % mapfile)
827+
old_mapfile = "%s.old" % mapfile
828+
if exists(old_mapfile):
829+
remove(old_mapfile)
830+
rename(mapfile, old_mapfile)
828831
return True
829832

830833
except IOError as error:

0 commit comments

Comments
 (0)