14
14
import java .nio .file .Paths ;
15
15
import java .util .ArrayList ;
16
16
import java .util .Collections ;
17
+ import java .util .Enumeration ;
17
18
import java .util .List ;
18
19
import java .util .stream .Collectors ;
19
20
import java .util .stream .Stream ;
@@ -46,15 +47,15 @@ public static FileUtils getInstance() {
46
47
return fileUtils ;
47
48
}
48
49
49
- protected Path getFileSystemPath (String path ) throws URISyntaxException , IOException {
50
+ protected Path getFileSystemPath (String path ) throws URISyntaxException , IOException {
50
51
ClassLoader loader = getClass ().getClassLoader ();
51
52
SimpleLogger .d (getClass (), "Getting URI for path: " + path );
52
- URI uri = loader .getResource (path ).toURI ();
53
- Path resultPath = null ;
54
- if (uri .getScheme ().contentEquals ("jar" )) {
55
- resultPath = getJarPath (uri , path );
53
+ URL url = loader .getResource (path );
54
+ if (url == null ) {
55
+ return null ;
56
56
}
57
- resultPath = Paths .get (uri );
57
+ URI uri = url .toURI ();
58
+ Path resultPath = Paths .get (uri );
58
59
SimpleLogger .d (getClass (), "Path for uri: " + uri + "\n " + resultPath .toString ());
59
60
return resultPath ;
60
61
}
@@ -78,6 +79,9 @@ public ArrayList<String> listResourceFolders(String path) throws IOException, UR
78
79
String separator = "" + FileUtils .DIRECTORY_SEPARATOR ;
79
80
ArrayList <String > folders = new ArrayList <String >();
80
81
Path listPath = getFileSystemPath (path );
82
+ if (listPath == null ) {
83
+ return folders ;
84
+ }
81
85
String listPathStr = listPath .toString ();
82
86
SimpleLogger .d (getClass (), "Listing folders in " + listPathStr );
83
87
int offset = listPathStr .endsWith (separator ) ? 0 : 1 ;
0 commit comments