forked from farion1231/cc-switch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopy_update.py
More file actions
56 lines (45 loc) · 1.79 KB
/
Copy pathcopy_update.py
File metadata and controls
56 lines (45 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import shutil
import sys
src = r"C:\GitHub\cc-switch\cc-switch-UPDATE"
dst = r"C:\GitHub\cc-switch"
results = []
# Step 1: Copy UPDATE over main directory
copied = 0
for root, dirs, files in os.walk(src):
dirs[:] = [d for d in dirs if d not in ('.git', 'target', 'node_modules', 'cc-switch-UPDATE')]
rel = os.path.relpath(root, src)
dst_dir = os.path.join(dst, rel)
for f in files:
src_file = os.path.join(root, f)
dst_file = os.path.join(dst_dir, f)
os.makedirs(dst_dir, exist_ok=True)
shutil.copy2(src_file, dst_file)
copied += 1
results.append(f"Step 1: Copied {copied} files from UPDATE")
# Step 2: Check if user's custom files survived
custom_files = [
(r"C:\GitHub\cc-switch\src-tauri\src\database\backends.rs", "database/backends.rs"),
(r"C:\GitHub\cc-switch\src-tauri\src\commands\backends.rs", "commands/backends.rs"),
]
for path, label in custom_files:
if os.path.exists(path):
size = os.path.getsize(path)
results.append(f" OK: {label} exists ({size} bytes)")
else:
results.append(f" MISSING: {label} does NOT exist")
# Step 3: Check key files
key_files = [
(r"C:\GitHub\cc-switch\src-tauri\src\database\schema.rs", "database/schema.rs"),
(r"C:\GitHub\cc-switch\src-tauri\src\database\mod.rs", "database/mod.rs"),
(r"C:\GitHub\cc-switch\src-tauri\src\commands\mod.rs", "commands/mod.rs"),
(r"C:\GitHub\cc-switch\src-tauri\src\lib.rs", "lib.rs"),
]
for path, label in key_files:
if os.path.exists(path):
size = os.path.getsize(path)
results.append(f" OK: {label} exists ({size} bytes)")
else:
results.append(f" MISSING: {label}")
with open(r"C:\GitHub\cc-switch\copy_result.txt", "w", encoding="utf-8") as f:
f.write("\n".join(results))