Skip to content

Commit

Permalink
perf: better tree root name parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed May 15, 2024
1 parent 47d4f29 commit df39f42
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,11 @@ private void openContainer(final Function<String, N5Reader> n5Fun, final Supplie
}

datasetDiscoverer = makeDiscoverer();
final String[] pathParts = n5Path.split(n5.getGroupSeparator());
final String rootName = pathParts[pathParts.length - 1];
final String[] pathParts = n5.getURI().toString().split(n5.getGroupSeparator());
final String suffix = (rootPath == null || rootPath.isEmpty()) ? "" : n5.getGroupSeparator() + rootPath;
final String treeRootName = pathParts[pathParts.length - 1] + suffix;
if (treeRenderer != null && treeRenderer instanceof N5DatasetTreeCellRenderer)
((N5DatasetTreeCellRenderer)treeRenderer).setRootName(rootName);
((N5DatasetTreeCellRenderer)treeRenderer).setRootName(treeRootName);

final N5TreeNode tmpRootNode = new N5TreeNode(rootPath);
rootNode = new N5SwingTreeNode(rootPath, treeModel);
Expand Down

0 comments on commit df39f42

Please sign in to comment.