MacOS tests fix: new way of discovering work dir conflicts with tests execution. Fixed.

This commit is contained in:
Federico Fissore 2015-02-03 17:00:51 +01:00
parent eaf4db5da8
commit 7adaba5630
2 changed files with 9 additions and 4 deletions

View File

@ -103,6 +103,7 @@
<junit printsummary="yes" dir="${work.dir}" fork="true">
<jvmarg value="-Djava.library.path=${java.additional.library.path}"/>
<jvmarg value="-DWORK_DIR=."/>
<classpath>
<pathelement location="bin"/>
<pathelement location="test-bin"/>

View File

@ -168,10 +168,14 @@ public class BaseNoGui {
File path = new File(System.getProperty("user.dir"));
if (OSUtils.isMacOS()) {
try {
path = new File(BaseNoGui.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
if (System.getProperty("WORK_DIR") != null) {
path = new File(System.getProperty("WORK_DIR"));
} else {
try {
path = new File(BaseNoGui.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()).getParentFile();
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}
}