lib/clamsy/cups_pdf_printer.rb in clamsy-0.0.4 vs lib/clamsy/cups_pdf_printer.rb in clamsy-0.0.5
- old
+ new
@@ -3,22 +3,20 @@
class << self
private
def doc_to_pdf(doc_path)
- system("#{config.ooffice_cmd} #{doc_path}")
+ system("#{config.ooffice_bin} #{config.ooffice_print_args} #{doc_path}")
pdf_path = tmp_pdf_path(doc_path)
file_must_exist!(pdf_path, 10) ; pdf_path
end
def tmp_pdf_path(doc_path)
if output_file = config.cups_output_file
output_file.is_a?(Proc) ? output_file.call : output_file
else
- # NOTE: we don't attempt to trim away the extension cos it is a hard
- # fact that internally we are always working with paths derived from
- # Tempfile instances, thus, no need for extension replacing.
- File.join(config.cups_output_dir, File.basename(doc_path)) + '.pdf'
+ ext = doc_path.split('.').last
+ File.join(config.cups_output_dir, File.basename(doc_path)).sub(/#{ext}$/, 'pdf')
end
end
end
end