Use a junction, as symlinks require escalated priviledges on some windows

This commit is contained in:
Ben Jackson 2020-07-24 21:27:28 +01:00
commit 1e43cd4870

View file

@ -331,10 +331,7 @@ def InstallCppTools( name, root, gadget ):
def InstallBashDebug( name, root, gadget ): def InstallBashDebug( name, root, gadget ):
MakeExecutable( os.path.join( root, MakeExecutable( os.path.join( root, 'extension', 'bashdb_dir', 'bashdb' ) )
'extension',
'bashdb_dir',
'bashdb' ) )
MakeExtensionSymlink( name, root ) MakeExtensionSymlink( name, root )
@ -585,10 +582,12 @@ def ValidateCheckSumSHA256( file_path, checksum ):
def RemoveIfExists( destination ): def RemoveIfExists( destination ):
if os.path.islink( destination ): try:
Print( "Removing link {}".format( destination ) )
os.remove( destination ) os.remove( destination )
Print( "Removed file {}".format( destination ) )
return return
except OSError:
pass
N = 1 N = 1
@ -678,7 +677,7 @@ def MakeSymlink( link, pointing_to, in_folder = None ):
link_path = os.path.abspath( link_path ) link_path = os.path.abspath( link_path )
if os.path.isdir( link_path ): if os.path.isdir( link_path ):
os.rmdir( link_path ) os.rmdir( link_path )
CheckCall( [ 'cmd.exe', '/c', 'mklink', '/D', link_path, pointing_to ] ) CheckCall( [ 'cmd.exe', '/c', 'mklink', '/J', link_path, pointing_to ] )
else: else:
os.symlink( pointing_to_relative, link_path ) os.symlink( pointing_to_relative, link_path )