lib/epub/maker.rb in epub-maker-0.0.6 vs lib/epub/maker.rb in epub-maker-0.0.7
- old
+ new
@@ -1,8 +1,9 @@
require 'English'
require 'pathname'
require 'fileutils'
+require 'tempfile'
require 'tmpdir'
require 'time'
require 'uuid'
require 'archive/zip'
require 'epub'
@@ -74,12 +75,11 @@
source_dir = Pathname(source_dir)
raise "source directory #{source_dir} not exist" unless source_dir.exist?
epub_file ||= source_dir.sub_ext(".epub")
epub_file = Pathname(epub_file)
-
- Pathname.mktmpdir do |dir|
- temp_dest = dir/epub_file.basename
+ Pathname.mktmpdir "epub-maker", epub_file.dirname do |dir|
+ temp_dest = Pathname(Tempfile.create(epub_file.basename.to_path, dir))
temp_container = dir/source_dir.basename
temp_container.mkdir
mimetype = temp_container/"mimetype"
mimetype.write EPUB::MediaType::EPUB