summaryrefslogtreecommitdiff
path: root/src/net/sourceforge/plantuml/Option.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/plantuml/Option.java')
-rw-r--r--src/net/sourceforge/plantuml/Option.java39
1 files changed, 34 insertions, 5 deletions
diff --git a/src/net/sourceforge/plantuml/Option.java b/src/net/sourceforge/plantuml/Option.java
index 4bb0e8d..3e93a38 100644
--- a/src/net/sourceforge/plantuml/Option.java
+++ b/src/net/sourceforge/plantuml/Option.java
@@ -2,7 +2,7 @@
* PlantUML : a free UML diagram generator
* ========================================================================
*
- * (C) Copyright 2009-2017, Arnaud Roques
+ * (C) Copyright 2009-2020, Arnaud Roques
*
* Project Info: http://plantuml.com
*
@@ -80,6 +80,7 @@ public class Option {
private int ftpPort = -1;
private boolean hideMetadata = false;
private boolean checkMetadata = false;
+ private int stdrpt = 0;
private int imageIndex = 0;
private File outputDir = null;
@@ -107,6 +108,7 @@ public class Option {
if (arg.length == 0) {
OptionFlags.getInstance().setGui(true);
}
+ initInclude(GraphvizUtils.getenvDefaultConfigFilename());
for (int i = 0; i < arg.length; i++) {
String s = arg[i];
if (s.equalsIgnoreCase("-headless")) {
@@ -344,6 +346,10 @@ public class Option {
preprocessorOutput = OptionPreprocOutputMode.CYPHER;
} else if (s.equalsIgnoreCase("-checkmetadata")) {
checkMetadata = true;
+ } else if (s.equalsIgnoreCase("-stdrpt:1")) {
+ stdrpt = 1;
+ } else if (s.equalsIgnoreCase("-stdrpt")) {
+ stdrpt = 1;
} else if (s.equalsIgnoreCase("-pipeimageindex")) {
i++;
if (i == arg.length) {
@@ -369,6 +375,17 @@ public class Option {
}
}
+ public Stdrpt getStdrpt() {
+ if (stdrpt == 1) {
+ return new StdrptV1();
+ }
+ // Legacy case
+ if (isPipe() || isPipeMap() || isSyntax()) {
+ return new StdrptPipe0();
+ }
+ return new StdrptNull();
+ }
+
public int getFtpPort() {
return ftpPort;
}
@@ -393,13 +410,21 @@ public class Option {
}
private void initInclude(String filename) throws IOException {
+ if (filename == null) {
+ return;
+ }
if (filename.contains("*")) {
final FileGroup group = new FileGroup(filename, Collections.<String> emptyList(), null);
for (File f : group.getFiles()) {
- addInConfig(new FileReader(f));
+ if (f.exists() && f.canRead()) {
+ addInConfig(new FileReader(f));
+ }
}
} else {
- addInConfig(new FileReader(filename));
+ final File f = new File(filename);
+ if (f.exists() && f.canRead()) {
+ addInConfig(new FileReader(f));
+ }
}
}
@@ -445,7 +470,11 @@ public class Option {
public Defines getDefaultDefines(File f) {
final Defines result = Defines.createWithFileName(f);
for (Map.Entry<String, String> ent : defines.entrySet()) {
- result.define(ent.getKey(), Arrays.asList(ent.getValue()), false);
+ String value = ent.getValue();
+ if (value == null) {
+ value = "";
+ }
+ result.define(ent.getKey(), Arrays.asList(value), false, null);
}
return result;
}
@@ -454,7 +483,7 @@ public class Option {
final Defines result = Defines.createEmpty();
result.overrideFilename(filename);
for (Map.Entry<String, String> ent : defines.entrySet()) {
- result.define(ent.getKey(), Arrays.asList(ent.getValue()), false);
+ result.define(ent.getKey(), Arrays.asList(ent.getValue()), false, null);
}
return result;
}