Skip to content

Commit c8e8df2

Browse files
committed
winecommand: disc recognition, first (failed) attempt
1 parent e6f613a commit c8e8df2

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

bottles/backend/wine/drives.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def get_drive(self, letter: str):
3232
return None
3333

3434
def set_drive_path(self, letter: str, path: str):
35-
"""Change a drives path in the bottle"""
35+
"""Change a drive's path in the bottle"""
3636
letter = f"{letter}:".lower()
3737
drive_sym_path = os.path.join(self.dosdevices_path, letter)
3838
if not os.path.exists(self.dosdevices_path):

bottles/backend/wine/winecommand.py

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import shutil
33
import stat
4+
import string
45
import subprocess
56
import tempfile
67
import shlex
@@ -25,6 +26,7 @@
2526
from bottles.backend.utils.manager import ManagerUtils
2627
from bottles.backend.utils.terminal import TerminalUtils
2728
from bottles.backend.utils.steam import SteamUtils
29+
from bottles.backend.wine.drives import Drives
2830

2931
logging = Logger()
3032

@@ -606,6 +608,7 @@ def get_cmd(
606608
command = f"sh '{pre_script}' ; {command}"
607609

608610
if disc_image is not None:
611+
# Mount/unmount disc image on temp mount point
609612
mount_point = "/tmp/bottles/disc"
610613
command = f"""
611614
flatpak-spawn --host mkdir -p '{mount_point}'
@@ -614,6 +617,15 @@ def get_cmd(
614617
flatpak-spawn --host fusermount -uz '{mount_point}' # -z for lazy unmount
615618
"""
616619

620+
# Assign path to first free drive letter
621+
drives = Drives(self.config)
622+
alphabet = string.ascii_uppercase
623+
letter = next(
624+
c for c in alphabet
625+
if c >= "D" and not drives.get_drive(c)
626+
)
627+
drives.set_drive_path(letter, mount_point)
628+
617629
return command
618630

619631
def _get_gamescope_cmd(self, return_steam_cmd: bool = False) -> str:

0 commit comments

Comments
 (0)