diff --git a/devenver.py b/devenver.py index f1393f5..5599951 100644 --- a/devenver.py +++ b/devenver.py @@ -396,8 +396,11 @@ def download_and_install_archive(download_url, # OS. use_hardlink = is_windows or os.name == 'nt' for symlink_entry in exe_dict["symlink"]: - symlink_dest = symlink_dir / symlink_entry - symlink_src = exe_path + 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 # ----------------------------------------------------------------------