mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-16 06:25:24 +00:00
Fix: Uninstall registry pointed non-exists directory (#88)
This commit is contained in:
parent
13c7e541f0
commit
29568c770c
@ -197,10 +197,7 @@ class EmulatorBase:
|
||||
list[str]:
|
||||
"""
|
||||
folder = self.abspath(folder)
|
||||
try:
|
||||
return list(iter_folder(folder, is_dir=is_dir, ext=ext))
|
||||
except FileNotFoundError:
|
||||
return []
|
||||
|
||||
|
||||
class EmulatorManagerBase:
|
||||
|
@ -476,9 +476,7 @@ class EmulatorManager(EmulatorManagerBase):
|
||||
if Emulator.is_emulator(file) and os.path.exists(file):
|
||||
exe.add(file)
|
||||
# MuMu specific directory
|
||||
folder = abspath(os.path.join(os.path.dirname(uninstall), 'EmulatorShell'))
|
||||
if os.path.exists(folder):
|
||||
for file in iter_folder(folder, ext='.exe'):
|
||||
for file in iter_folder(abspath(os.path.join(os.path.dirname(uninstall), 'EmulatorShell')), ext='.exe'):
|
||||
if Emulator.is_emulator(file) and os.path.exists(file):
|
||||
exe.add(file)
|
||||
|
||||
|
@ -35,7 +35,12 @@ def iter_folder(folder, is_dir=False, ext=None):
|
||||
Yields:
|
||||
str: Absolute path of files
|
||||
"""
|
||||
for file in os.listdir(folder):
|
||||
try:
|
||||
files = os.listdir(folder)
|
||||
except FileNotFoundError:
|
||||
return
|
||||
|
||||
for file in files:
|
||||
sub = os.path.join(folder, file)
|
||||
if is_dir:
|
||||
if os.path.isdir(sub):
|
||||
|
Loading…
Reference in New Issue
Block a user