// TODO: replace static "arch/win32" with something smarter
// inspired by http://www.mkyong.com/java/how-to-detect-os-in-java-systemgetpropertyosname/
if(this.fpcalcFilename == null) {
throw new InitializationFailedException("fpcalc file name not set. Please configure it with musicbrainz.acoustid.fpcalcFilename");
}
if(this.binariesPath == null) {
throw new InitializationFailedException("Binary directory not set. Please configure it with org.socialmusicdiscovery.path.binaries");
}
try {
// Strange hack to concatenate path (how come that Java doesn't include such tools?
this.fpcalcPath = new File(new File(binariesPath, "arch/win32").getCanonicalPath(), this.fpcalcFilename).getCanonicalPath();
} catch (IOException e) {
// TODO: change init interface method to throw exception?
throw new InitializationFailedException("fpcalc executable path invalid or not set: "+ binariesPath+"/"+"arch/win32/"+this.fpcalcFilename);
}
if(this.fpcalcPath == null || (new File(this.fpcalcPath).isFile() == false) ) {
throw new InitializationFailedException("fpcalc executable path invalid or not set: "+ this.fpcalcPath);
}
// second argument of constructor is media filename and will be completed later in the process for each file
this.pb = new ProcessBuilder(this.fpcalcPath, null);