Skip to content
This repository has been archived by the owner on Oct 23, 2018. It is now read-only.

Commit

Permalink
Add option to show hidden files and directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Sirisak Lueangsaksri committed Jul 27, 2015
1 parent 794f42b commit 87ae5d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Javatar.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -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 //
///////////////////
Expand Down
18 changes: 16 additions & 2 deletions commands/javatar_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down
4 changes: 2 additions & 2 deletions utils/javatar_browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 87ae5d9

Please sign in to comment.