Browse files

Allow setting module path.

  • Loading branch information...
1 parent d5f08da commit 129f7a91b44073781c2cf7a42ce838285d27ac4d @tschaub committed May 29, 2012
Showing with 15 additions and 8 deletions.
  1. +7 −2 bin/geoscript
  2. +8 −6 src/main/java/org/geoscript/js/GeoScriptModules.java
View
9 bin/geoscript
@@ -49,15 +49,20 @@ else
CLASS=org.geoscript.js.GeoScriptShell
fi
+ARGS=
+if [ -x $MODULES ]; then
+ ARGS="-Dgeoscript.modules=$MODULES"
+fi
+
if [ $# -eq 1 ]; then
# resolve absolute path to main module
MAIN_PATH=$(
cd -P -- "$(dirname -- "$1")" \
&& pwd -P
) && MAIN_PATH=$MAIN_PATH/$(basename -- "$1")
- java -cp $CP $CLASS -main $MAIN_PATH
+ java -cp $CP $ARGS $CLASS -main $MAIN_PATH
else
- java -cp $CP $CLASS
+ java -cp $CP $ARGS $CLASS
fi
View
14 src/main/java/org/geoscript/js/GeoScriptModules.java
@@ -6,12 +6,14 @@
public class GeoScriptModules {
public static String getModulePath() {
- URL moduleUrl = GeoScriptModules.class.getResource("lib");
- String modulePath;
- try {
- modulePath = moduleUrl.toURI().toString();
- } catch (URISyntaxException e) {
- throw new RuntimeException("Trouble evaluating GeoScript module path.", e);
+ String modulePath = System.getProperty("geoscript.modules");
+ if (modulePath == null) {
+ URL moduleUrl = GeoScriptModules.class.getResource("lib");
+ try {
+ modulePath = moduleUrl.toURI().toString();
+ } catch (URISyntaxException e) {
+ throw new RuntimeException("Trouble evaluating GeoScript module path.", e);
+ }
}
return modulePath;
}

0 comments on commit 129f7a9

Please sign in to comment.