From ec40c51600606bea717b39aacb5138fac13cb30b Mon Sep 17 00:00:00 2001 From: itdominator <1itdominator@gmail.com> Date: Tue, 1 Feb 2022 23:26:40 -0600 Subject: [PATCH] Fixed save and load logic --- src/shellfm/windows/WindowController.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/shellfm/windows/WindowController.py b/src/shellfm/windows/WindowController.py index 9e570bb..6cc5bfa 100644 --- a/src/shellfm/windows/WindowController.py +++ b/src/shellfm/windows/WindowController.py @@ -134,7 +134,10 @@ class WindowController: - def save_state(self, session_file = self.session_file): + def save_state(self, session_file = None): + if not session_file: + session_file = self.session_file + windows = [] for window in self.windows: views = [] @@ -158,7 +161,10 @@ class WindowController: with open(session_file, 'w') as outfile: json.dump(windows, outfile, separators=(',', ':'), indent=4) - def load_state(self, session_file = self.session_file): + def load_state(self, session_file = None): + if not session_file: + session_file = self.session_file + if path.isfile(session_file): with open(session_file) as infile: return json.load(infile)