INNER CODE UNIT · Python
CreateCygwinSymlink
DaemonEngine/Daemon · external_deps/cygtar.py:66
def CreateCygwinSymlink(filepath, target):
"""Create a Cygwin 1.7 style link
Generates a Cygwin style symlink by creating a SYSTEM tagged
file with the !<link> marker followed by a unicode path.
"""
# If we failed to create a symlink, then just copy it. We wrap this in a
# retry for Windows which often has stale file lock issues.
for cnt in range(1,4):
try:
lnk = open(filepath, 'wb')
lnk.write(PathToSymDat(target))
lnk.close()
break
except EnvironmentError:
print('Try %d: Failed open %s -> %s\n' % (cnt, filepath, target))
# Verify the file was created