From 52401988e4087d08f22fd95d5e319c8c2b014275 Mon Sep 17 00:00:00 2001 From: Ludovic LANGE Date: Mon, 10 Feb 2025 10:56:35 +0100 Subject: [PATCH] fix #2 - errors in console and plugin not working fixed a few things: - plugin now works accross multiple platformes - not restricted to Windows - handle the case where a file has no `file_name()` --- CloseFolder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CloseFolder.py b/CloseFolder.py index 2e6e80c..143c215 100644 --- a/CloseFolder.py +++ b/CloseFolder.py @@ -23,7 +23,8 @@ class CloseFolderDirs(sublime_plugin.WindowCommand): def run(self, dirs=[]): views = sublime.active_window().views() for dr in dirs: - dr += '\\' + dr = os.path.join(os.path.normpath(dr), "") for vw in views: - if (os.path.dirname(vw.file_name()) + '\\').find(dr) == 0: - vw.close() + if vw.file_name(): + if os.path.join(os.path.normpath(os.path.dirname(vw.file_name())), "").find(dr) == 0: + vw.close()