Skip to content

Commit

Permalink
adjust base dir & scripts for excution outside koans dir
Browse files Browse the repository at this point in the history
  • Loading branch information
matyb committed Nov 3, 2011
1 parent a8e458f commit 528c385
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
18 changes: 12 additions & 6 deletions koans-lib/src/com/sandwich/util/io/directories/DirectorySet.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.sandwich.util.io.directories;

import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;

abstract class DirectorySet {

Expand Down Expand Up @@ -39,14 +41,18 @@ public String getDataDir(){
}

private static String createBaseDir() {
File dir = new File(".");
dir = new File(dir.getAbsolutePath().replace("%20", " "));
if (dir.exists()) {
dir = dir.getParentFile();
try {
URL path = DirectorySet.class.getClassLoader().getResource(".");
File dir = new File(path.toURI());
if (dir.exists()) {
dir = dir.getParentFile();
dir = dir.getParentFile();
if (dir.exists()) {
dir = dir.getParentFile();
}
}
return dir.getAbsolutePath();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
return dir.getAbsolutePath();
}
}
Binary file modified koans/lib/koans.jar
Binary file not shown.
1 change: 1 addition & 0 deletions koans/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ javac -version
if ERRORLEVEL 3 goto no_javac
java -version
if ERRORLEVEL 1 goto no_java
mkdir "%~dp0\bin"
cls
java -classpath "%~dp0\bin;%~dp0\lib\koans.jar" com.sandwich.koan.runner.AppLauncher %1 %2 %3 %4 %5 %6 %7 %8 %9

Expand Down
3 changes: 2 additions & 1 deletion koans/run.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
clear
DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
mkdir "$DIR"/bin
clear
java -classpath "$DIR"/bin:"$DIR"/lib/koans.jar com.sandwich.koan.runner.AppLauncher "$1" "$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9"

0 comments on commit 528c385

Please sign in to comment.