1 parent 6217c97 commit a0d2318Copy full SHA for a0d2318
1 file changed
core/src/test/java/com/github/jsonldjava/utils/TestUtils.java
@@ -26,8 +26,12 @@ public static InputStream copyResourceToFileStream(File testDir, String resource
26
}
27
28
public static String copyResourceToFile(File testDir, String resource) throws Exception {
29
- String filename = resource.substring(resource.lastIndexOf('/'));
30
- String directory = resource.substring(0, resource.lastIndexOf('/'));
+ String filename = resource;
+ String directory = "";
31
+ if (resource.contains("/")) {
32
+ filename = resource.substring(resource.lastIndexOf('/'));
33
+ directory = resource.substring(0, resource.lastIndexOf('/'));
34
+ }
35
File nextDirectory = new File(testDir, directory);
36
nextDirectory.mkdirs();
37
File nextFile = new File(nextDirectory, filename);
0 commit comments