1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
---
layout: default
class: Analyzer
title: -output FILE
summary: Specify the output directory or file.
---
TODO how does this relate to -outputmask?
/**
* Calculate the output file for the given target. The strategy is:
*
* <pre>
* parameter given if not null and not directory
* if directory, this will be the output directory
* based on bsn-version.jar
* name of the source file if exists
* Untitled-[n]
* </pre>
*
* @param output
* may be null, otherwise a file path relative to base
*/
public File getOutputFile(String output) {
if (output == null)
output = get(Constants.OUTPUT);
File outputDir;
if (output != null) {
File outputFile = getFile(output);
if (outputFile.isDirectory())
outputDir = outputFile;
else
return outputFile;
} else
outputDir = getBase();
Entry<String,Attrs> name = getBundleSymbolicName();
if (name != null) {
String bsn = name.getKey();
String version = getBundleVersion();
Version v = Version.parseVersion(version);
String outputName = bsn + "-" + v.getWithoutQualifier() + Constants.DEFAULT_JAR_EXTENSION;
return new File(outputDir, outputName);
}
File source = getJar().getSource();
if (source != null) {
String outputName = source.getName();
return new File(outputDir, outputName);
}
error("Cannot establish an output name from %s, nor bsn, nor source file name, using Untitled", output);
int n = 0;
File f = getFile(outputDir, "Untitled");
while (f.isFile()) {
f = getFile(outputDir, "Untitled-" + n++);
}
return f;
}
|