hbc/locations: arg is file only if absolute or .rb file
Handle the case when an argument passed to `brew cask` is both the name of a Cask and a non-Cask file in the current working directory. Fixes https://github.com/caskroom/homebrew-cask/issues/25611.
This commit is contained in:
parent
63122c241c
commit
b4fc4acc09
@ -133,9 +133,8 @@ module Hbc
|
|||||||
def path(query)
|
def path(query)
|
||||||
query_path = Pathname.new(query)
|
query_path = Pathname.new(query)
|
||||||
|
|
||||||
if query_path.exist? || query_path.absolute?
|
return query_path if query_path.absolute?
|
||||||
return query_path
|
return query_path if query_path.exist? && query_path.extname == ".rb"
|
||||||
end
|
|
||||||
|
|
||||||
query_without_extension = query.sub(%r{\.rb$}i, "")
|
query_without_extension = query.sub(%r{\.rb$}i, "")
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user