Skip to content

Commit 207f0c4

Browse files
committed
Rename getRoot() to getRootDirectory() in FileStorage
1 parent 67d03b3 commit 207f0c4

4 files changed

Lines changed: 15 additions & 15 deletions

File tree

shellfx-storage/src/main/java/com/techsenger/shellfx/storage/AbstractDefaultFileStorage.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public T getFile(URI uri) throws NoSuchFileException, AccessDeniedException, Inv
148148
public T getParent(T file) throws NoSuchFileException, AccessDeniedException, IOException {
149149
var parentUri = UriUtils.getParentUri(getRootUri(), file.getUri());
150150
if (parentUri == null) {
151-
return getRoot();
151+
return getRootDirectory();
152152
}
153153
var path = toPath(parentUri);
154154
checkIfExists(path);
@@ -157,7 +157,7 @@ public T getParent(T file) throws NoSuchFileException, AccessDeniedException, IO
157157

158158
@Override
159159
@SuppressWarnings("unchecked")
160-
public T getRoot() {
160+
public T getRootDirectory() {
161161
var file = fileFactory.create();
162162
file.setVirtual(true);
163163
file.setEntryType(FileEntryType.DIRECTORY);

shellfx-storage/src/main/java/com/techsenger/shellfx/storage/DefaultGenericFile.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private List<DefaultGenericFile> buildParents(int limit) {
236236
parents.add(parent);
237237
}
238238
if (parents.size() < limit) {
239-
parents.add((DefaultGenericFile) storage.getRoot());
239+
parents.add((DefaultGenericFile) storage.getRootDirectory());
240240
}
241241
return parents;
242242
}

shellfx-storage/src/main/java/com/techsenger/shellfx/storage/FileStorage.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,17 @@ public interface FileStorage<T extends GenericFile> {
7474
*/
7575
boolean isDefault();
7676

77+
/**
78+
* Returns the root directory entry of this storage.
79+
*
80+
* <p>The root may be either a real directory (e.g. on a network drive) or a virtual
81+
* placeholder (e.g. a local file system root that does not physically exist as a standalone
82+
* directory entry).
83+
*
84+
* @return the root entry, never {@code null}
85+
*/
86+
T getRootDirectory();
87+
7788
/**
7889
* Returns the direct subdirectories of the directory identified by {@code uri}, excluding regular files.
7990
*
@@ -136,17 +147,6 @@ public interface FileStorage<T extends GenericFile> {
136147
*/
137148
T getParent(T file) throws NoSuchFileException, AccessDeniedException, IOException;
138149

139-
/**
140-
* Returns the root directory entry of this storage.
141-
*
142-
* <p>The root may be either a real directory (e.g. on a network drive) or a virtual
143-
* placeholder (e.g. a local file system root that does not physically exist as a standalone
144-
* directory entry).
145-
*
146-
* @return the root entry, never {@code null}
147-
*/
148-
T getRoot();
149-
150150
/**
151151
* Creates a new directory at the given URI. Only one directory level is created; the parent
152152
* directory must already exist.

shellfx-storage/src/test/java/com/techsenger/shellfx/storage/DefaultGenericFileTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ void setUp() {
5252
root.setVirtual(true);
5353

5454
when(storage.getRootUri()).thenReturn(rootUri);
55-
when(storage.getRoot()).thenReturn(root);
55+
when(storage.getRootDirectory()).thenReturn(root);
5656

5757
URI childUri = IS_WINDOWS
5858
? URI.create("file:///C:/home/user/foo/bar")

0 commit comments

Comments
 (0)