Skip to content

Commit

Permalink
When globbing in ZipFSDir, take CWD into account.
Browse files Browse the repository at this point in the history
  • Loading branch information
hainesr committed Apr 30, 2018
1 parent 1673da7 commit aa6284d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/zip/filesystem.rb
Expand Up @@ -573,8 +573,8 @@ def get_output_stream(fileName, permissionInt = nil, &aProc)
@zipFile.get_output_stream(expand_to_entry(fileName), permissionInt, &aProc)
end

def glob(*args, &block)
@zipFile.glob(*args, &block)
def glob(pattern, *flags, &block)
@zipFile.glob(expand_to_entry(pattern), *flags, &block)
end

def read(fileName)
Expand Down
5 changes: 5 additions & 0 deletions test/filesystem/directory_test.rb
Expand Up @@ -109,6 +109,11 @@ def test_glob
zf.dir.glob('globTest/foo/**/*.txt') do |f|
assert_equal globbed_files[0], f.name
end

zf.dir.chdir('globTest/foo')
zf.dir.glob('**/*.txt') do |f|
assert_equal globbed_files[0], f.name
end
end
end

Expand Down

0 comments on commit aa6284d

Please sign in to comment.