Unlink symlink before re-creating

This commit is contained in:
rdb 2014-05-28 15:55:18 +00:00
parent 7785426d2c
commit 3d5118d406

View File

@ -2328,15 +2328,20 @@ def SetupBuildEnvironment(compiler):
######################################################################## ########################################################################
def CopyFile(dstfile, srcfile): def CopyFile(dstfile, srcfile):
if (dstfile[-1]=='/'): if dstfile[-1] == '/':
dstdir = dstfile dstdir = dstfile
fnl = srcfile.rfind("/") fnl = srcfile.rfind("/")
if (fnl < 0): fn = srcfile if fnl < 0:
else: fn = srcfile[fnl+1:] fn = srcfile
else:
fn = srcfile[fnl+1:]
dstfile = dstdir + fn dstfile = dstdir + fn
if NeedsBuild([dstfile], [srcfile]): if NeedsBuild([dstfile], [srcfile]):
if os.path.islink(srcfile): if os.path.islink(srcfile):
# Preserve symlinks # Preserve symlinks
if os.path.exists(dstfile):
os.unlink(dstfile)
os.symlink(os.readlink(srcfile), dstfile) os.symlink(os.readlink(srcfile), dstfile)
else: else:
WriteBinaryFile(dstfile, ReadBinaryFile(srcfile)) WriteBinaryFile(dstfile, ReadBinaryFile(srcfile))