Skip to content

Commit 8c688d0

Browse files
committed
updated crash message to include date
1 parent 042a07a commit 8c688d0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

main.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from collections import deque
1414
from traceback import print_exception
1515
import re
16+
import datetime
1617

1718
from algorithmic_compiler import AlgorithmicCompiler
1819
from cpp_compiler import CppCompiler
@@ -505,22 +506,27 @@ def _on_crash_recover(self):
505506
"""
506507
If a crash file exists, asks the user if they want to recover.
507508
"""
509+
CRASH_FILE_PATH = os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME)
508510
def recover_crash_data():
509-
with open(os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME), "r", encoding="utf-8") as f:
511+
with open(CRASH_FILE_PATH, "r", encoding="utf-8") as f:
510512
self.current_text = f.read()
511513
self.display_text()
512514
self.is_crash_reboot = True
513515

516+
modify_time = os.path.getmtime(CRASH_FILE_PATH)
517+
modify_date = datetime.datetime.fromtimestamp(modify_time)
518+
dateD_H_str = modify_date.strftime("%d/%m/%Y %H:%M:%S")
519+
514520
display_menu(
515521
self.stdscr,
516522
(
517523
("Yes", recover_crash_data),
518524
("No", lambda: None)
519525
),
520-
label=self.get_translation("crash_recovery"),
526+
label=self.get_translation("crash_recovery", date=dateD_H_str),
521527
clear=False
522528
)
523-
os.remove(os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME))
529+
os.remove(CRASH_FILE_PATH)
524530

525531

526532
@property

0 commit comments

Comments
 (0)