lib/slim_lint/utils.rb in slim_lint-0.15.1 vs lib/slim_lint/utils.rb in slim_lint-0.16.0
- old
+ new
@@ -1,5 +1,7 @@
+# frozen_string_literal: true
+
module SlimLint
# Miscellaneus collection of helper functions.
module Utils
module_function
@@ -11,11 +13,12 @@
#
# @param glob [String, Array]
# @param file [String]
# @return [Boolean]
def any_glob_matches?(globs_or_glob, file)
+ path = File.expand_path(file)
Array(globs_or_glob).any? do |glob|
- ::File.fnmatch?(glob, file,
+ ::File.fnmatch?(File.expand_path(glob), path,
::File::FNM_PATHNAME | # Wildcards don't match path separators
::File::FNM_DOTMATCH) # `*` wildcard matches dotfiles
end
end