JAL-629 add an {extension} substitution
[jalview.git] / src / jalview / bin / argparser / ArgParser.java
index 7132e89..2a3272c 100644 (file)
@@ -81,6 +81,11 @@ public class ArgParser
   // the linked id substitution string used to use the idCounter
   private static final String LINKEDIDAUTOCOUNTER = "{n}";
 
+  // the linked id substitution string used to use the filename extension of
+  // --append
+  // or --open
+  private static final String LINKEDIDEXTENSION = "{extension}";
+
   // the linked id substitution string used to use the base filename of --append
   // or --open
   private static final String LINKEDIDBASENAME = "{basename}";
@@ -637,6 +642,10 @@ public class ArgParser
       {
         rest = rest.replace(LINKEDIDBASENAME, avm.getBasename());
       }
+      if (rest.contains(LINKEDIDEXTENSION))
+      {
+        rest = rest.replace(LINKEDIDEXTENSION, avm.getExtension());
+      }
       if (rest.contains(LINKEDIDDIRNAME))
       {
         rest = rest.replace(LINKEDIDDIRNAME, avm.getDirname());