More file browser improvements [release]

This commit is contained in:
crschnick
2023-03-15 17:33:07 +00:00
parent 355de8e2fc
commit d5e024c43e
8 changed files with 101 additions and 57 deletions
@@ -65,6 +65,14 @@ public class FileNames {
}
public static String getParent(String file) {
if (split(file).size() == 0) {
return null;
}
if (split(file).size() == 1) {
return file.startsWith("/") && !file.equals("/") ? "/" : null;
}
return file.substring(0, file.length() - getFileName(file).length() - 1);
}
@@ -21,7 +21,6 @@ public interface FileSystem extends Closeable, AutoCloseable {
FileSystem fileSystem;
@NonNull
String path;
@NonNull
Instant date;
boolean directory;
boolean hidden;
@@ -29,7 +28,7 @@ public interface FileSystem extends Closeable, AutoCloseable {
long size;
public FileEntry(
@NonNull FileSystem fileSystem, @NonNull String path, @NonNull Instant date, boolean directory, boolean hidden, Boolean executable,
@NonNull FileSystem fileSystem, @NonNull String path, Instant date, boolean directory, boolean hidden, Boolean executable,
long size
) {
this.fileSystem = fileSystem;