diff --git a/Javatar.sublime-settings b/Javatar.sublime-settings index 360d578..49f0589 100644 --- a/Javatar.sublime-settings +++ b/Javatar.sublime-settings @@ -55,6 +55,9 @@ // Initial directory for finding dependencies "dependencies_path" : "$project_dir", + // Show hidden files and directories for browsing dependencies + "show_hidden_files_and_directories": false, + /////////////////// // Java Settings // /////////////////// diff --git a/commands/javatar_settings.py b/commands/javatar_settings.py index 3f13e91..ed2a5e2 100644 --- a/commands/javatar_settings.py +++ b/commands/javatar_settings.py @@ -57,10 +57,24 @@ def get_folders(self): return folders def jar_file_filter(self, path): - return os.path.isdir(path) or path.endswith(".jar") + if (os.path.basename(path).startswith(".") and + get_settings("show_hidden_files_and_directories") and + (os.path.isdir(path) or path.endswith(".jar"))): + return True + return ( + not os.path.basename(path).startswith(".") and + (os.path.isdir(path) or path.endswith(".jar")) + ) def directory_filter(self, path): - return os.path.isdir(path) + if (os.path.basename(path).startswith(".") and + get_settings("show_hidden_files_and_directories") and + (os.path.isdir(path) or path.endswith(".jar"))): + return True + return ( + not os.path.basename(path).startswith(".") and + os.path.isdir(path) + ) def file_prelist(self, path): dir_list = [] diff --git a/utils/javatar_browse.py b/utils/javatar_browse.py index 9d2abd5..b9ce344 100644 --- a/utils/javatar_browse.py +++ b/utils/javatar_browse.py @@ -28,11 +28,11 @@ def get_list(self, path): dir_list += self.prelist(path) for name in os.listdir(path): pathname = os.path.join(path, name) - if not name.startswith(".") and os.path.isdir(pathname) and (self.path_filter is None or self.path_filter is not None and self.path_filter(pathname)): + if os.path.isdir(pathname) and (self.path_filter is None or self.path_filter is not None and self.path_filter(pathname)): dir_list.append(["[" + name + "]", pathname]) for name in os.listdir(path): pathname = os.path.join(path, name) - if not name.startswith(".") and os.path.isfile(pathname) and (self.path_filter is None or self.path_filter is not None and self.path_filter(pathname)): + if os.path.isfile(pathname) and (self.path_filter is None or self.path_filter is not None and self.path_filter(pathname)): dir_list.append([name, pathname]) if self.postlist is not None: dir_list += self.postlist(path)