aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/fr
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/fr')
-rw-r--r--src/main/java/fr/umlv/java/wallj/Main.java27
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
9import java.awt.*; 9import java.awt.*;
10import java.io.IOException; 10import java.io.IOException;
11import java.net.URI;
11import java.net.URISyntaxException; 12import java.net.URISyntaxException;
12import java.nio.file.Path; 13import java.nio.file.*;
13import java.nio.file.Paths; 14import java.util.HashMap;
14import java.util.LinkedList; 15import java.util.LinkedList;
15import java.util.List; 16import java.util.List;
17import java.util.Map;
16 18
17public class Main { 19public 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 }