INNER CODE UNIT · Python
PathToSymDat
DaemonEngine/Daemon · external_deps/cygtar.py:58
def PathToSymDat(filepath):
"""Convert a filepath to cygwin style symlink data."""
symtag = '!<symlink>\xff\xfe'
unipath = ''.join([ch + '\x00' for ch in filepath])
strterm = '\x00\x00'
return symtag + unipath + strterm
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: