|
13 | 13 | from collections import deque |
14 | 14 | from traceback import print_exception |
15 | 15 | import re |
| 16 | +import datetime |
16 | 17 |
|
17 | 18 | from algorithmic_compiler import AlgorithmicCompiler |
18 | 19 | from cpp_compiler import CppCompiler |
@@ -505,22 +506,27 @@ def _on_crash_recover(self): |
505 | 506 | """ |
506 | 507 | If a crash file exists, asks the user if they want to recover. |
507 | 508 | """ |
| 509 | + CRASH_FILE_PATH = os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME) |
508 | 510 | 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: |
510 | 512 | self.current_text = f.read() |
511 | 513 | self.display_text() |
512 | 514 | self.is_crash_reboot = True |
513 | 515 |
|
| 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 | + |
514 | 520 | display_menu( |
515 | 521 | self.stdscr, |
516 | 522 | ( |
517 | 523 | ("Yes", recover_crash_data), |
518 | 524 | ("No", lambda: None) |
519 | 525 | ), |
520 | | - label=self.get_translation("crash_recovery"), |
| 526 | + label=self.get_translation("crash_recovery", date=dateD_H_str), |
521 | 527 | clear=False |
522 | 528 | ) |
523 | | - os.remove(os.path.join(os.path.dirname(__file__), CRASH_FILE_NAME)) |
| 529 | + os.remove(CRASH_FILE_PATH) |
524 | 530 |
|
525 | 531 |
|
526 | 532 | @property |
|
0 commit comments