Fix terminal.export_logs plugin

not working as expected on non-android devices
• related to FileSelectorWindow
This commit is contained in:
! Freaku 2025-02-08 14:34:32 +05:30 committed by GitHub
parent 51b6ef91e0
commit 62fa808b21
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -254,26 +254,31 @@ class export_logs(babase.Plugin):
path = default_directory) path = default_directory)
return return
FileSelectorWindow(default_directory, babase.app.ui_v1.get_main_window().main_window_replace(
FileSelectorWindow(default_directory,
callback=self.start_export_logs, callback=self.start_export_logs,
show_base_path=True, show_base_path=True,
allow_folders=True) allow_folders=True)
)
def start_export_logs(self, path: str, create_subfolder: bool = False): def start_export_logs(self, path: str, create_subfolder: bool = False):
if create_subfolder: if path:
path = path + 'BombSquad/' if babase.app.classic.platform != 'android':
os.makedirs(path, exist_ok=True) babase.app.ui_v1.get_main_window().main_window_back()
if os.path.exists(log_post): if create_subfolder:
with open(path + '/logs.txt', 'w+') as e: path = path + 'BombSquad/'
e.write(open(log_post).read()) os.makedirs(path, exist_ok=True)
e.close() if os.path.exists(log_post):
bui.screenmessage('logs.txt saved') with open(path + '/logs.txt', 'w+') as e:
e.write(open(log_post).read())
if os.path.exists(previous_log_post): e.close()
with open(path + '/logs (previous game launch).txt', 'w+') as e: bui.screenmessage('logs.txt saved')
e.write(open(previous_log_post).read())
e.close() if os.path.exists(previous_log_post):
bui.screenmessage('logs (previous game launch).txt saved') with open(path + '/logs (previous game launch).txt', 'w+') as e:
e.write(open(previous_log_post).read())
e.close()
bui.screenmessage('logs (previous game launch).txt saved')
# ba_meta export plugin # ba_meta export plugin