Skip to content

Commit

Permalink
Make multeval.sh run from arbitrary working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
cidermole committed Jan 21, 2016
1 parent bd93ed1 commit ba7c703
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion multeval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ done

# Specify -Dfile.encoding so that the meteor paraphrase tables load properly
java -Dfile.encoding=UTF8 $flags \
-cp $terJar:$meteorJar:$scriptDir/multeval-${version}.jar \
-cp $terJar:$meteorJar:$scriptDir/multeval-${version}.jar:$scriptDir \
multeval.MultEval "$@"
4 changes: 2 additions & 2 deletions src/multeval/MultEval.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import jannopts.Configurator;

import java.io.IOException;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -72,7 +72,7 @@ static int initThreads(final List<Metric<?>> metrics, int threads) {

private static String loadVersion() throws IOException {
Properties props = new Properties();
FileInputStream in = new FileInputStream("constants");
InputStream in = MultEval.class.getResourceAsStream("/constants");
props.load(in);
in.close();
String version = props.getProperty("version");
Expand Down

2 comments on commit ba7c703

@ypeels
Copy link

@ypeels ypeels commented on ba7c703 Jan 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't that look for a file named constants at the root directory instead?

I think it's cleaner to bake the version number in at compile time using the manifest, but I'm not really sure the Java code and manifest I posted are production-ready

@cidermole
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Not in the root directory of the system, but in the root(s) of the classpath.

Your fix solves the bug as well, through baking the version into the JAR. That avoids having to point to $scriptDir itself in the classpath in multeval.sh. I think that one should be a no-brainer merge request.

Please sign in to comment.