On Wednesday, 24 May 2017 03.51.55 WEST Scott Kostyshak wrote:
> Any objection from anyone else?
> 
> Scott

Honestly the use of the plus sign as a special character seems unnatural to 
me. :-)

My suggestion would be to pass an option that specify just that, say -d. The 
advantage of this approach it that it does not add new special characters.

A patch follows attached. I have not updated the documentation.

Regards,
-- 
José Abílio
diff --git a/lib/scripts/ext_copy.py b/lib/scripts/ext_copy.py
index fb70d7bbba..dae9ae616f 100644
--- a/lib/scripts/ext_copy.py
+++ b/lib/scripts/ext_copy.py
@@ -13,11 +13,11 @@
 
 # This script is to be used as a "copier" script in the sense needed by
 # the converter definitions. Given a <from file> and <to file>, it will copy
-# all files in the directory in which from_file is found that have the 
-# extensions given in the -e argument, or all files in that directory if no 
+# all files in the directory in which from_file is found that have the
+# extensions given in the -e argument, or all files in that directory if no
 # such argument is given. So, for example, we can do:
 #   python ext_copy.py -e png,html,css /path/from/file.html /path/to/file.html
-# and all html, png, and css files in /path/from/ will be copied to the 
+# and all html, png, and css files in /path/from/ will be copied to the
 # (possibly new) directory /path/to/file.html.LyXconv/.
 # The -t argument determines the extension added, the default being "LyXconv".
 # If just . is given, no extension is added.
@@ -32,13 +32,16 @@ def main(argv):
     progname = argv[0]
 
     exts = [] #list of extensions for which we're checking
+    use_doc_dir = False
     targext = "LyXconv" #extension for target directory
-    opts, args = getopt.getopt(sys.argv[1:], "e:t:")
+    opts, args = getopt.getopt(sys.argv[1:], "de:t:")
     for o, v in opts:
       if o == "-e":
         exts = v.split(',')
       if o == "-t":
         targext = v
+      if o == "-d":
+        use_doc_dir = True
 
     # input directory
     if len(args) != 2:
@@ -49,11 +52,14 @@ def main(argv):
     from_dir = os.path.dirname(abs_from_file)
 
     # output directory
-    to_dir = args[1]
-    if targext != '.':
-      to_dir += "." + targext
-    if not os.path.isabs(to_dir):
-      error("%s is not an absolute file name.\n%s" % to_dir, usage(progname))
+    if use_doc_dir:
+      to_dir = os.path.dirname(args[1])
+    else:
+      to_dir = args[1]
+      if targext != '.':
+        to_dir += "." + targext
+      if not os.path.isabs(to_dir):
+        error("%s is not an absolute file name.\n%s" % to_dir, usage(progname))
 
     if not copy_all(from_dir, to_dir, exts):
       # some kind of failure

Reply via email to