Ensure .out files are saved into logDirectory

Signed-off-by: Khalid Shakir <kshakir@broadinstitute.org>
This commit is contained in:
pdexheimer 2013-11-25 11:03:01 -05:00 committed by Khalid Shakir
parent 51dcd364a5
commit 504c125c26
1 changed files with 11 additions and 2 deletions

View File

@ -377,9 +377,18 @@ trait QFunction extends Logging with QJobReport {
jobName = qSettings.runName + "-" + this.addOrder.mkString("-")
if (jobOutputFile == null) {
/*If the outputFile has been set to an absolute path, respect that.
Otherwise, place it in (possibly a subdirectory of) the log directory
The relative case is first as it's arguably the most common condition
*/
jobOutputFile = firstOutput match {
case file: File if (!IOUtils.isSpecialFile(file)) => new File(file.getParentFile, file.getName + ".out")
case _ => new File(jobName + ".out")
case file: File if (!IOUtils.isSpecialFile(file) && !file.isAbsolute) => {
val logDir : File = if (file.getParentFile() == null) qSettings.logDirectory else new File(qSettings.logDirectory, file.getParent)
new File(logDir, file.getName + ".out")
}
case file: File if (!IOUtils.isSpecialFile(file) && file.isAbsolute) =>
new File(file.getParentFile, file.getName + ".out")
case _ => new File(qSettings.logDirectory, jobName + ".out")
}
}