Skip to content

Commit

Permalink
Fix mismatch of output basename for file and dir
Browse files Browse the repository at this point in the history
 1. one doc, -o /tmp/foo => /tmp/foo.doc
 2. two docs, -o /tmp/ => /tmp/foo/doc1.doc, /tmp/foo/doc2.doc
  • Loading branch information
jirib authored and dagwieers committed Jul 1, 2015
1 parent bd0f756 commit 45fc428
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions unoconv
Original file line number Diff line number Diff line change
Expand Up @@ -959,11 +959,11 @@ class Convertor:
if not op.stdout:
(outputfn, ext) = os.path.splitext(inputfn)
if not op.output:
outputfn = outputfn + os.extsep + outputfmt.extension
outputfn = realpath(outputfn + os.extsep + outputfmt.extension)
elif len(op.filenames) > 1:
outputfn = op.output + os.extsep + outputfmt.extension
else:
outputfn = realpath(op.output, os.path.basename(outputfn) + os.extsep + outputfmt.extension)
else:
outputfn = realpath(outputfn + os.extsep + outputfmt.extension)

This comment has been minimized.

Copy link
@sese

sese Jul 3, 2015

the outputfn will be always the basename of input file plus extension, you should change to outputfn = realpath(op.output + os.extsep + outputfmt.extension)

This comment has been minimized.

Copy link
@dagwieers

dagwieers via email Jul 3, 2015

Member

This comment has been minimized.

Copy link
@sese

sese Jul 3, 2015

but you use to split the inputfn variabile which is the input file not the output file (line 960)

This comment has been minimized.

Copy link
@dagwieers

dagwieers Jul 4, 2015

Member

Ah, now I see what you mean. In case op.output is set, we are not using it. That's a problem. Thanks for the insight ! (PS: A pull-request would have been more clear in understanding your logic ;-))


outputurl = unohelper.absolutize( self.cwd, unohelper.systemPathToFileUrl(outputfn) )
info(1, "Output file: %s" % outputfn)
Expand Down

0 comments on commit 45fc428

Please sign in to comment.