lib/fontist/import/recursive_extraction.rb in fontist-1.7.3 vs lib/fontist/import/recursive_extraction.rb in fontist-1.8.1
- old
+ new
@@ -116,10 +116,13 @@
end
def font_directory?(path, base_path)
return true unless @subdir
+ # https://bugs.ruby-lang.org/issues/10011
+ base_path = Pathname.new(base_path)
+
relative_path = Pathname.new(path).relative_path_from(base_path).to_s
dirname = File.dirname(relative_path)
normalized_pattern = @subdir.chomp("/")
File.fnmatch?(normalized_pattern, dirname)
end
@@ -145,10 +148,11 @@
@operations.last[:options] ||= {}
@operations.last[:options][:fonts_sub_dir] = @subdir
end
def find_archive(path)
- paths = Dir.children(path).map { |file| File.join(path, file) }
+ children = Dir.entries(path) - [".", ".."] # ruby 2.4 compat
+ paths = children.map { |file| File.join(path, file) }
by_subarchive(paths) || by_size(paths)
end
def by_subarchive(paths)
return unless @subarchive