From 2a1ed46ddd6a7b9dc3b2bf91405e02b29ba75b87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Krekel=C3=A4?= Date: Sat, 1 Sep 2018 22:03:31 +0300 Subject: [PATCH] Open the right file --- src/open_default_files.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/open_default_files.py b/src/open_default_files.py index 0c39ae3..7f0367d 100644 --- a/src/open_default_files.py +++ b/src/open_default_files.py @@ -10,8 +10,9 @@ def open_all(): raise KeyError('$HOME is not set') from err # If the directory doesn't exist, just return empty + sshwot_dir_path = os.path.join(homedir, '.sshwot') try: - sshwot_dir = os.listdir(os.path.join(homedir, '.sshwot')) + sshwot_dir = os.listdir(sshwot_dir_path) except FileNotFoundError: return [] @@ -19,6 +20,7 @@ def open_all(): files = [] for dir_entry in sshwot_dir: if dir_entry.split('.')[-1] == 'sshwot': - files.append(open(dir_entry, 'rb')) + path = os.path.join(sshwot_dir_path, dir_entry) + files.append(open(path, 'rb')) return files