Use relative symlinks

This commit is contained in:
doylet 2026-02-21 17:04:38 +11:00
parent 84f0d9e43d
commit 4d99747372

View File

@ -398,6 +398,9 @@ def download_and_install_archive(download_url,
for symlink_entry in exe_dict["symlink"]:
symlink_dest = symlink_dir / symlink_entry
symlink_src = exe_path
symlink_rel_src = pathlib.Path(symlink_src).relative_to(install_dir)
symlink_rel_dest = pathlib.Path(symlink_dest).relative_to(install_dir)
skip_link = False;
if os.path.exists(symlink_dest):
# Windows uses hardlinks because symlinks require you to enable "developer" mode
@ -414,11 +417,13 @@ def download_and_install_archive(download_url,
else:
os.unlink(symlink_dest)
import contextlib
if not skip_link:
if use_hardlink:
os.link(src=symlink_src, dst=symlink_dest)
else:
os.symlink(src=symlink_src, dst=symlink_dest)
with contextlib.chdir(install_dir):
os.symlink(src=symlink_rel_src, dst=symlink_dest)
# Collect paths to add to the devenv script
# ----------------------------------------------------------------------