lib/file/find.rb in file-find-0.3.9 vs lib/file/find.rb in file-find-0.4.0
- old
+ new
@@ -7,11 +7,11 @@
# Do nothing, not required, just nicer.
end
class File::Find
# The version of the file-find library
- VERSION = '0.3.9'
+ VERSION = '0.4.0'.freeze
# :stopdoc:
VALID_OPTIONS = %w[
atime
ctime
@@ -256,10 +256,12 @@
next unless stat_info.nlink == @links
end
if @maxdepth || @mindepth
file_depth = file.split(File::SEPARATOR).length
- path_depth = @path.split(File::SEPARATOR).length
+ current_base_path = [@path].flatten.find{ |tpath| file.include?(tpath) }
+ path_depth = current_base_path.split(File::SEPARATOR).length
+
depth = file_depth - path_depth
if @maxdepth && (depth > @maxdepth)
if File.directory?(file)
unless paths.include?(file) && depth > @maxdepth