|
@@ -23,6 +23,7 @@
|
23
|
23
|
package com.dmdirc.util.io;
|
24
|
24
|
|
25
|
25
|
import java.io.IOException;
|
|
26
|
+import java.net.URISyntaxException;
|
26
|
27
|
import java.net.URL;
|
27
|
28
|
import java.nio.file.CopyOption;
|
28
|
29
|
import java.nio.file.DirectoryStream;
|
|
@@ -49,9 +50,12 @@ public final class FileUtils {
|
49
|
50
|
* @throws IOException If the resource couldn't be copied.
|
50
|
51
|
*/
|
51
|
52
|
public static void copyResources(final URL source, final Path destination) throws IOException {
|
52
|
|
- final Path sourcePath = Paths.get(source.toString());
|
53
|
|
-
|
54
|
|
- copyRecursively(sourcePath, destination, StandardCopyOption.REPLACE_EXISTING);
|
|
53
|
+ try {
|
|
54
|
+ copyRecursively(Paths.get(source.toURI()), destination,
|
|
55
|
+ StandardCopyOption.REPLACE_EXISTING);
|
|
56
|
+ } catch (URISyntaxException ex) {
|
|
57
|
+ throw new IOException("Unable to get source URI", ex);
|
|
58
|
+ }
|
55
|
59
|
}
|
56
|
60
|
|
57
|
61
|
/**
|
|
@@ -65,7 +69,7 @@ public final class FileUtils {
|
65
|
69
|
*/
|
66
|
70
|
public static void copyRecursively(final Path source, final Path destination,
|
67
|
71
|
final CopyOption... options) throws IOException {
|
68
|
|
- final Path destinationPath = destination.resolve(source.getFileName());
|
|
72
|
+ final Path destinationPath = destination.resolve(source.getFileName().toString());
|
69
|
73
|
|
70
|
74
|
if (Files.isDirectory(source)) {
|
71
|
75
|
Files.createDirectories(destinationPath);
|