Skip to content

Commit 518329a

Browse files
committed
feat: Add check for validating symlinks in pfx/dosdevices
1 parent 706de21 commit 518329a

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/wemod.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,24 @@ def init(proton: str, iswine: bool = False) -> None:
560560
[None],
561561
[None],
562562
)
563+
# Ensure dosdevices exists and `drive_c`/`drive_z` are correctly symlinked.
564+
dosdevices = os.path.join(WINEPREFIX, "dosdevices")
565+
566+
# Validate symlinks.
567+
if os.path.isdir(dosdevices):
568+
from mainutils import create_symlink
569+
c_drive = os.path.join(dosdevices, "c:")
570+
z_drive = os.path.join(dosdevices, "z:")
571+
# Check c_drive is a symlink.
572+
if not os.path.islink(c_drive) or os.readlink(c_drive) != '../drive_c':
573+
create_symlink("../drive_c", c_drive)
574+
# Check z_drive is a symlink.
575+
if not os.path.islink(z_drive) or os.readlink(z_drive) != '/':
576+
create_symlink("/", z_drive)
577+
578+
assert os.path.islink(c_drive) and os.readlink(c_drive) == '../drive_c'
579+
assert os.path.islink(z_drive) and os.readlink(z_drive) == '/'
580+
563581
syncwemod() # Sync WeMod data
564582
log(
565583
f"Copied Proton version {cut_version[0]}.{cut_version[1]} prefix to game prefix that was on version {current_version_parts[0]}.{current_version_parts[1]}"

0 commit comments

Comments
 (0)