ebook_tools 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/ebook_tools.gemspec +1 -1
- data/lib/ebook_tools.rb +5 -2
- metadata +1 -1
data/CHANGELOG
CHANGED
data/ebook_tools.gemspec
CHANGED
data/lib/ebook_tools.rb
CHANGED
@@ -234,12 +234,15 @@ module EbookTools
|
|
234
234
|
# :format 指定需要提取结构的文件后缀名,例如要从所有txt文件中提取,通过:format=>'.txt'指定
|
235
235
|
def batch_extract_from_dir(source,destination,options={})
|
236
236
|
format = options.delete(:format)
|
237
|
-
|
237
|
+
source_path = File.absolute_path(source)
|
238
|
+
dest_path = File.absolute_path(destination)
|
239
|
+
|
240
|
+
files = Utils.scan_file_from_dir(source_path,{:format=>format})
|
238
241
|
|
239
242
|
files.each do |file|
|
240
243
|
extname = File.extname(file)
|
241
244
|
basename = File.basename(file,extname)
|
242
|
-
dest_file = File.join(File.dirname(File.join(
|
245
|
+
dest_file = File.join(File.dirname(File.join(dest_path,file.gsub(source,''))),"#{basename}.xml")
|
243
246
|
if allow_extract_struct?(file)
|
244
247
|
puts "start extract #{file} ..."
|
245
248
|
begin
|