Skip to content
This repository was archived by the owner on Jan 9, 2026. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions RomM/romm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import sdl2
import sdl2.ext
from models import Rom

if os.path.exists(os.path.join(os.path.dirname(__file__), "__version__.py")):
from __version__ import version
Expand Down Expand Up @@ -609,14 +610,7 @@ def _update_roms_view(self):
(
f"{glyphs.delete} Remove from device",
1,
lambda: os.remove(
os.path.join(
self.fs.get_platforms_storage_path(
selected_rom.platform_slug
),
selected_rom.fs_name,
)
),
lambda: self._remove_rom_files(selected_rom),
),
)
else:
Expand Down Expand Up @@ -877,3 +871,27 @@ def update(self):
self._update_contextual_menu()

self._update_common()

def _remove_rom_files(self, rom: Rom):
storage_path = self.fs.get_platforms_storage_path(rom.platform_slug)

if rom.multi:
# Read the m3u file to get the list of ROMs under the .hidden folder
rom_list_path = os.path.join(storage_path, rom.fs_name + ".m3u")
if os.path.isfile(rom_list_path):
with open(rom_list_path, "r") as f:
for line in f:
filename = line.strip()
if filename:
full_path = os.path.join(storage_path, filename)
if os.path.commonpath(
[storage_path, full_path]
) == storage_path and os.path.isfile(full_path):
os.remove(full_path)
os.remove(rom_list_path)
else:
full_path = os.path.join(storage_path, rom.fs_name)
if os.path.commonpath(
[storage_path, full_path]
) == storage_path and os.path.isfile(full_path):
os.remove(full_path)