Skip to content

Commit

Permalink
Ignore files in the session that do not exist
Browse files Browse the repository at this point in the history
src/application.py
src/window.py
  • Loading branch information
ShikiOkasaka committed May 19, 2024
1 parent d69d2a2 commit 811f2f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,23 +70,21 @@ def do_activate(self):
args = line.split()
if len(args) < 10:
continue
LOGGER.info(f'{len(args)}')
x = int(args[2])
y = int(args[4])
w = int(args[6])
h = int(args[8])
path = args[9]
LOGGER.info(f'do_activate: -x {x} -y {y} -w {w} -h {h} {path}')

file = Gio.File.new_for_path(path)
win = self.is_opened(file)
if win:
win.present()
else:
elif os.path.isfile(path):
win = Window(self, file=file)
win.show_all()
win.move(x, y)
win.resize(w, h)
win.move(x, y)
win.resize(w, h)
except OSError:
LOGGER.exception(f"Could not read '{pathname}'")
except TypeError:
Expand Down
1 change: 1 addition & 0 deletions src/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def _load_file(self, file):
self.buffer.place_cursor(self.buffer.get_start_iter())
self.buffer.set_modified(False)
except GLib.Error:
LOGGER.exception(f'Could not read "{self.file.get_path()}"')
# Create a new file
self.save()
self.update_title()
Expand Down

0 comments on commit 811f2f5

Please sign in to comment.