Windows compatibility
This commit is contained in:
+10
-7
@@ -1,10 +1,11 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
from collections import defaultdict
|
||||
from pathlib import Path
|
||||
|
||||
from collections import defaultdict
|
||||
from platform_utils import replace_with_link_or_copy, safe_filename
|
||||
|
||||
def main():
|
||||
if len(sys.argv) < 3:
|
||||
@@ -54,7 +55,7 @@ def main():
|
||||
elif len(ids) > 1:
|
||||
print(f"ALERT: Name '{name}' assigned to multiple IDs: {', '.join(ids)}")
|
||||
|
||||
safe_name = re.sub(r'[<>:"/\\|?*]', '', name).strip()
|
||||
safe_name = safe_filename(name)
|
||||
|
||||
for copie_id in ids:
|
||||
path_b = os.path.join(work_dir, f"{bnot_dir}/Copie{copie_id}")
|
||||
@@ -81,9 +82,11 @@ def main():
|
||||
src_file = os.path.join(source_folder, src_name)
|
||||
dst_link = os.path.join(dest_path, dst_name)
|
||||
try:
|
||||
if os.path.lexists(dst_link): os.remove(dst_link)
|
||||
if os.path.exists(src_file): os.symlink(src_file, dst_link)
|
||||
except Exception as e:
|
||||
if os.path.exists(src_file):
|
||||
method = replace_with_link_or_copy(src_file, dst_link, prefer="symlink")
|
||||
if method == "copy":
|
||||
print(f"Copied {src_name} for {dest_folder_name} (links unavailable)")
|
||||
except OSError as e:
|
||||
print(f"Error linking {src_name} for {dest_folder_name}: {e}")
|
||||
|
||||
# --- 4. Print Unassigned Names ---
|
||||
|
||||
Reference in New Issue
Block a user