@@ -1119,19 +1119,25 @@ private Number getDouble(Map<String, Object> src, String key) {
1119
1119
public String [] getUsedFiles (boolean noPixels ) {
1120
1120
FormatTools .assertId (currentId , true , 1 );
1121
1121
String zarrRootPath = currentId .substring (0 , currentId .indexOf (".zarr" ) + 5 );
1122
+ int rootPathLength = zarrRootPath .length ();
1122
1123
ArrayList <String > usedFiles = new ArrayList <String >();
1123
1124
reloadOptionsFile (zarrRootPath );
1124
1125
1125
1126
boolean skipPixels = noPixels || !listPixels () || !systemEnvListPixels ();
1126
1127
boolean includeLabels = includeLabels ();
1127
1128
try (Stream <Path > paths = Files .walk (Paths .get (zarrRootPath ), FileVisitOption .FOLLOW_LINKS )) {
1128
1129
paths .filter (Files ::isRegularFile )
1129
- .forEach (path -> {if ((!skipPixels && includeLabels ) ||
1130
- (!skipPixels && !includeLabels && !path .toString ().toLowerCase ().contains ("labels" )) ||
1131
- (skipPixels && includeLabels && (path .endsWith (".zgroup" ) || path .endsWith (".zattrs" ) || path .endsWith (".xml" ))) ||
1132
- (skipPixels && !includeLabels && !path .toString ().toLowerCase ().contains ("labels" ) &&(path .endsWith (".zgroup" ) || path .endsWith (".zattrs" ) || path .endsWith (".xml" ))))
1133
- usedFiles .add (path .toFile ().getAbsolutePath ());
1134
- });
1130
+ .forEach (path -> {
1131
+ if (
1132
+ (!skipPixels && includeLabels ) ||
1133
+ (!skipPixels && !includeLabels && (path .toString ().toLowerCase ().lastIndexOf ("labels" )<rootPathLength ) ||
1134
+ (skipPixels && includeLabels && (path .endsWith (".zgroup" ) || path .endsWith (".zattrs" ) || path .endsWith (".xml" ))) ||
1135
+ (skipPixels && !includeLabels && (path .toString ().toLowerCase ().lastIndexOf ("labels" )<rootPathLength ) &&(path .endsWith (".zgroup" ) || path .endsWith (".zattrs" ) || path .endsWith (".xml" )))))
1136
+ {
1137
+ usedFiles .add (path .toFile ().getAbsolutePath ());
1138
+ }
1139
+ }
1140
+ );
1135
1141
} catch (IOException e ) {
1136
1142
e .printStackTrace ();
1137
1143
}
0 commit comments