Implement Dir.glob base option #4936
Merged
Conversation
dirs = new ArrayList<ByteList>(); | ||
} else if (tmp.isNil()) { | ||
dir = base.isEmpty() ? runtime.getCurrentDirectory() : base; | ||
dirs = Dir.push_glob(runtime, dir, globArgumentAsByteList(context, args[0]), flags); |
ChrisBr
Jan 5, 2018
Author
Contributor
Wondering what the difference between runtime.getCurrentDirectory()
and getCWD(runtime)
or is it possible to simplify the code and only use either or?
Wondering what the difference between runtime.getCurrentDirectory()
and getCWD(runtime)
or is it possible to simplify the code and only use either or?
enebo
Jan 5, 2018
Member
@ChrisBr getCWD will force canonicalization whereas runtime.getCurrentDirectory is whatever it was set to (which might have already been canonicalized). Even if we happen to always canon. the stored value getCWD always tries to do it again (unless it is an URI).
Dir.glob is a dirty beast and I do not remember what contract it has for the incoming directory but that would be the proper guidance on which to use.
@ChrisBr getCWD will force canonicalization whereas runtime.getCurrentDirectory is whatever it was set to (which might have already been canonicalized). Even if we happen to always canon. the stored value getCWD always tries to do it again (unless it is an URI).
Dir.glob is a dirty beast and I do not remember what contract it has for the incoming directory but that would be the proper guidance on which to use.
ChrisBr
added a commit
to ChrisBr/jruby
that referenced
this pull request
Jan 6, 2018
now it throws an ArgumentError like it does in MRI. Introduced in jruby#4936.
ChrisBr
added a commit
to ChrisBr/jruby
that referenced
this pull request
Jan 9, 2018
now it throws an ArgumentError like it does in MRI. Introduced in jruby#4936.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
https://bugs.ruby-lang.org/issues/13056
Tests c&p from ruby/ruby@52419a6.
#4876