lib/chupa-text/decomposers/libreoffice.rb in chupa-text-decomposer-libreoffice-1.0.0 vs lib/chupa-text/decomposers/libreoffice.rb in chupa-text-decomposer-libreoffice-1.0.1
- old
+ new
@@ -80,22 +80,23 @@
end
nil
end
def expand_candidate(candidate)
- Dir.glob("/opt/libreoffice*/program/#{candidate}").first
+ Dir.glob("/opt/libreoffice*/program/#{candidate}").first or
+ Dir.glob("C:/Program Files*/libreoffice*/program/#{candidate}.exe").first
end
def convert_to_pdf(data)
Dir.mktmpdir do |temporary_directory|
output = Tempfile.new("chupa-text-decomposer-libreoffice-output")
error = Tempfile.new("chupa-text-decomposer-libreoffice-error")
succeeded = @command.run("--headless",
"--nologo",
"--convert-to", "pdf",
"--outdir", temporary_directory,
- data.path,
+ data.path.to_s,
{
:spawn_options => {
:out => output.path,
:err => error.path,
},
@@ -120,10 +121,10 @@
].join("\n")
ChupaText.logger.error(message)
return nil
end
File.open(pdf_path, "rb") do |pdf|
- ChupaText::VirtualFileData.new(pdf_path, pdf)
+ ChupaText::VirtualFileData.new(pdf_path, pdf, :source_data => data)
end
end
end
end
end