diff --git a/lib/bootsnap/load_path_cache/cache.rb b/lib/bootsnap/load_path_cache/cache.rb index 71a154c9..71754afe 100644 --- a/lib/bootsnap/load_path_cache/cache.rb +++ b/lib/bootsnap/load_path_cache/cache.rb @@ -132,10 +132,11 @@ def push_paths_locked(*paths) p = Path.new(path) @has_relative_paths = true if p.relative? next if p.non_directory? + expanded_path = p.expanded_path entries, dirs = p.entries_and_dirs(@store) # push -> low precedence -> set only if unset dirs.each { |dir| @dirs[dir] ||= true } - entries.each { |rel| @index[rel] ||= p.expanded_path } + entries.each { |rel| @index[rel] ||= expanded_path } end end end @@ -145,10 +146,11 @@ def unshift_paths_locked(*paths) paths.map(&:to_s).reverse_each do |path| p = Path.new(path) next if p.non_directory? + expanded_path = p.expanded_path entries, dirs = p.entries_and_dirs(@store) # unshift -> high precedence -> unconditional set dirs.each { |dir| @dirs[dir] = true } - entries.each { |rel| @index[rel] = p.expanded_path } + entries.each { |rel| @index[rel] = expanded_path } end end end