Browse code

fix archetype

devnewton authored on 27/07/2014 at 21:13:20
Showing 3 changed files
... ...
@@ -5,47 +5,17 @@ Requirements
5 5
 ============
6 6
 
7 7
 Java JDK, [openjdk](http://openjdk.java.net/) or [Oracle](http://java.com): 1.7+
8
-[Maven](http://www.maven.org) 3+
8
+[Maven](http://www.maven.org) 3+,
9
+[bash](https://www.gnu.org/software/bash/) 4+
9 10
 
10 11
 Compile
11 12
 =======
12 13
 
13
-Go to the source folder and run maven with the following command:
14
+Go to the source folder and run the build.sh script using bash:
14 15
 
15
-	mvn package
16
-
17
-This will generate an executable jar in target subfolder named ${rootArtifactId}-game-${symbol_dollar}{project.version}.jar
16
+	bash build.sh
18 17
 
19 18
 Install
20 19
 =======
21 20
 
22
-Manual installation
23
-
24
-- Create a directory, for example /opt/${rootArtifactId}-game
25
-- Copy the game/target/${rootArtifactId}-game-${symbol_dollar}{project.version}.jar, the game/target/natives, game/target/lib and assets folders into it.
26
-
27
-Create packages and installers
28
-
29
-Using maven 3 plugins, rpm and deb can be generated and also a generic [izpack](www.izpack.org) based installer.
30
-
31
-	mvn clean package -Pizpack,deb,rpm
32
-
33
-Run
34
-===
35
-
36
-
37
-The game can be run using the following command:
38
-
39
-	java -jar ${rootArtifactId}-game-${symbol_dollar}{project.version}.jar
40
-
41
-It will try to load the game data files in
42
-
43
-	./assets
44
-
45
-or
46
-
47
-	../assets
48
-
49
-NB: lwjgl shared libraries must be loadable, check the [lwjgl](www.lwjgl.org) documentation for more information.
21
+The build.sh script generate installers for various OS in the target/release subfolder. Use them to install the game.
... ...
@@ -2,10 +2,11 @@
2 2
 #set( $symbol_dollar = '$' )
3 3
 #set( $symbol_escape = '\' )
4 4
 ${symbol_pound}!/bin/bash
5
-mvn clean package -Pwin,deb,rpm
5
+mvn clean package -Pwin,deb
6
+[ $(which rpm) ] && mvn package -Prpm
6 7
 mkdir -p target/release
7 8
 cp packages/generic/target/${rootArtifactId}-installer*.jar target/release/
8 9
 cp packages/win/target/${rootArtifactId}-installer*.exe target/release/
9 10
 cp packages/deb/target/${rootArtifactId}*.deb target/release/
10
-cp packages/rpm32/target/rpm/${rootArtifactId}/RPMS/*/${rootArtifactId}-*.rpm target/release/
11
-cp packages/rpm64/target/rpm/${rootArtifactId}/RPMS/*/${rootArtifactId}-*.rpm target/release/
11
+[ $(which rpm) ] && cp packages/rpm32/target/rpm/${rootArtifactId}/RPMS/*/${rootArtifactId}-*.rpm target/release/
12
+[ $(which rpm) ] && cp packages/rpm64/target/rpm/${rootArtifactId}/RPMS/*/${rootArtifactId}-*.rpm target/release/
... ...
@@ -99,8 +99,17 @@ public class GameModule extends AbstractModule {
99 99
     @Provides
100 100
     @Singleton
101 101
     public VirtualFileSystem createVfs() {
102
-        File applicationDir = NormalLauncher.getApplicationDir();
103
-        return new VirtualFileSystem(new File(applicationDir, "assets"), new File(applicationDir.getParentFile(), "assets"));
102
+        File currentDir = NormalLauncher.getApplicationDir();
103
+        for (;;) {
104
+            File assetsDir = new File(currentDir, "assets");
105
+            if (assetsDir.exists()) {
106
+                return new VirtualFileSystem(assetsDir);
107
+            }
108
+            currentDir = currentDir.getParentFile();
109
+            if (null == currentDir) {
110
+                throw new RuntimeException("Cannot find assets directory");
111
+            }
112
+        }
104 113
     }
105 114
     
106 115
     @Provides