diff options
Diffstat (limited to 'src/main/java/fr')
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/Main.java | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/Main.java b/src/main/java/fr/umlv/java/wallj/Main.java index 5f0ca99..946a61c 100644 --- a/src/main/java/fr/umlv/java/wallj/Main.java +++ b/src/main/java/fr/umlv/java/wallj/Main.java | |||
@@ -8,26 +8,29 @@ import fr.umlv.zen5.Application; | |||
8 | 8 | ||
9 | import java.awt.*; | 9 | import java.awt.*; |
10 | import java.io.IOException; | 10 | import java.io.IOException; |
11 | import java.net.URI; | ||
11 | import java.net.URISyntaxException; | 12 | import java.net.URISyntaxException; |
12 | import java.nio.file.Path; | 13 | import java.nio.file.*; |
13 | import java.nio.file.Paths; | 14 | import java.util.HashMap; |
14 | import java.util.LinkedList; | 15 | import java.util.LinkedList; |
15 | import java.util.List; | 16 | import java.util.List; |
17 | import java.util.Map; | ||
16 | 18 | ||
17 | public class Main { | 19 | public class Main { |
18 | 20 | ||
19 | private static Path getResourcePath(String str) throws URISyntaxException { | 21 | private static final String DEFAULT_MAP_NAME = "/maps/level0.txt"; |
20 | return Paths.get(Main.class.getResource(str).toURI()); | 22 | private static java.util.List<Path> getResourcePaths(String[] args) throws URISyntaxException,IOException { |
21 | } | ||
22 | |||
23 | private static java.util.List<Path> getResourcePaths(String[] args) throws URISyntaxException { | ||
24 | LinkedList<Path> paths = new LinkedList<>(); | 23 | LinkedList<Path> paths = new LinkedList<>(); |
25 | if (args.length > 0) { | 24 | String strFolder = System.getProperty("levels"); |
26 | for (String string : args) { | 25 | if (strFolder != null) { |
27 | paths.add(Paths.get(string)); | 26 | Path pathFolder = Paths.get(strFolder); |
28 | } | 27 | Files.newDirectoryStream(pathFolder).forEach(paths::add); |
29 | } else { | 28 | } else { |
30 | paths.add(getResourcePath("/maps/level0.txt")); | 29 | final URI uri = Main.class.getResource(DEFAULT_MAP_NAME).toURI(); |
30 | Map<String, String> env = new HashMap<>(); | ||
31 | env.put("create", "true"); | ||
32 | FileSystem zipfs = FileSystems.newFileSystem(uri, env); | ||
33 | paths.add(Paths.get(uri)); | ||
31 | } | 34 | } |
32 | return paths; | 35 | return paths; |
33 | } | 36 | } |