File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 3434
3535import re
3636from pathlib import Path
37+ import sys
38+ import shutil
3739
3840
3941def create_versioned_dir (root_dir : str | Path ) -> Path :
@@ -101,8 +103,15 @@ def create_versioned_dir(root_dir: str | Path) -> Path:
101103 # Update the 'latest' symbolic link to point to the new version directory
102104 latest_link_path = root_dir / "latest"
103105 if latest_link_path .is_symlink () or latest_link_path .exists ():
104- latest_link_path .unlink ()
105- latest_link_path .symlink_to (new_version_dir , target_is_directory = True )
106+ if latest_link_path .is_dir () and not latest_link_path .is_symlink ():
107+ shutil .rmtree (latest_link_path )
108+ else :
109+ latest_link_path .unlink ()
110+ if sys .platform .startswith ("win" ):
111+ # On Windows, copy instead of symlink to avoid privilege issues
112+ shutil .copytree (new_version_dir , latest_link_path )
113+ else :
114+ latest_link_path .symlink_to (new_version_dir , target_is_directory = True )
106115
107116 return latest_link_path
108117
You can’t perform that action at this time.
0 commit comments