Skip to content

Commit db6ba80

Browse files
author
emmanue1
committed
Fix a display bug on TreeView
1 parent cb55392 commit db6ba80

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

services/src/main/java/org/jd/gui/model/container/GenericContainer.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,18 @@ public URI getUri() {
8787

8888
public String getPath() {
8989
if (strPath == null) {
90-
if (rootNameCount == fsPath.getNameCount()) {
90+
int nameCount = fsPath.getNameCount();
91+
92+
if (rootNameCount == nameCount) {
9193
strPath = "";
9294
} else {
93-
strPath = fsPath.subpath(rootNameCount, fsPath.getNameCount()).toString();
94-
if (strPath.endsWith(fsPath.getFileSystem().getSeparator())) {
95+
strPath = fsPath.subpath(rootNameCount, nameCount).toString().replace(fsPath.getFileSystem().getSeparator(), "/");
96+
97+
int strPathLength = strPath.length();
98+
99+
if ((strPathLength > 0) && strPath.charAt(strPathLength-1) == '/') {
95100
// Cut last separator
96-
strPath = strPath.substring(0, strPath.length()-fsPath.getFileSystem().getSeparator().length());
101+
strPath = strPath.substring(0, strPathLength-1);
97102
}
98103
}
99104
}

0 commit comments

Comments
 (0)