Skip to content

Commit

Permalink
Fix file browser
Browse files Browse the repository at this point in the history
  • Loading branch information
brp14005 committed Mar 4, 2016
1 parent 7243188 commit f6d17fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/java/directory/FileTreeItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ private ObservableList<FileTreeItem> buildChildren(TreeItem<IronFile> ironTreeIt
ObservableList<FileTreeItem> children = FXCollections.observableArrayList();

for (IronFile childFile : files) {
if(childFile.filter.accept(childFile, childFile.getName())) {
// if(childFile.filter.accept(childFile, childFile.getName())) { // saved for later
children.add(new FileTreeItem(childFile));
}
// }
}
return children;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/directory/IronFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class IronFile extends File {
public IronFile(String pathname) {
super(pathname);
isRoot = (getParent() == null);
// filter = new IronFileFilter();
filter = new IronFileFilter();
}
/**
* Construct an IronFile that extends File. This is an overloaded method
Expand All @@ -39,7 +39,7 @@ public IronFile(String pathname) {
public IronFile(File file) {
super(file.getPath());
isRoot = (getParent() == null);
// filter = new IronFileFilter();
filter = new IronFileFilter();
fileAttributeView = Files.getFileAttributeView(this.toPath(), UserDefinedFileAttributeView.class);
}

Expand Down
9 changes: 2 additions & 7 deletions src/main/java/utils/IronFileFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@ public boolean accept(File file, String name) {
isSymbolic = Files.isSymbolicLink(file.toPath());
isRegularFile = Files.isRegularFile(file.toPath());
} catch(Exception e) {

}

if(hidden || isSymbolic || (!isRegularFile && !file.isDirectory())) {
//System.out.println(name + " is hidden or a symbolic link, or just not a regular file");
return false;
System.out.println(e);
}
return true;
return !(hidden || isSymbolic || (!isRegularFile && !file.isDirectory()));
}
}

0 comments on commit f6d17fc

Please sign in to comment.