forked from Wobbl/Bread_Editor
Made it open the example file if the last opened file doesn't exist anymore.
This commit is contained in:
parent
eb9c22967f
commit
b829164f0d
1 changed files with 6 additions and 1 deletions
7
utils.py
7
utils.py
|
@ -110,6 +110,11 @@ class Utils:
|
||||||
if len(sys.argv) == 1: # if no parameters were passed to the editor
|
if len(sys.argv) == 1: # if no parameters were passed to the editor
|
||||||
file_path = self.app.settings.last_opened_file
|
file_path = self.app.settings.last_opened_file
|
||||||
|
|
||||||
if os.path.isfile(file_path):
|
if os.path.isfile(file_path): # open last opened file if it still exists else open the example file
|
||||||
|
file = File(self.app, file_path, file_path.split("/")[-1])
|
||||||
|
self.app.open_files[file_path] = file
|
||||||
|
|
||||||
|
else:
|
||||||
|
file_path = f"{os.path.dirname(os.path.abspath(__file__))}/example.txt"
|
||||||
file = File(self.app, file_path, file_path.split("/")[-1])
|
file = File(self.app, file_path, file_path.split("/")[-1])
|
||||||
self.app.open_files[file_path] = file
|
self.app.open_files[file_path] = file
|
||||||
|
|
Loading…
Add table
Reference in a new issue