@@ -21,7 +21,7 @@ module FeatureLoader
21
21
@expanded_load_path = [ ]
22
22
# A snapshot of $LOAD_PATH, to check if the @expanded_load_path cache is up to date.
23
23
@load_path_copy = [ ]
24
- @relative_path_in_load_path = false
24
+ # nil if there is no relative path in $LOAD_PATH, a copy of the cwd to check if the cwd changed otherwise.
25
25
@working_directory_copy = nil
26
26
27
27
def self . clear_cache
@@ -284,10 +284,9 @@ def self.get_expanded_load_path
284
284
unless Primitive . array_storage_equal? ( @load_path_copy , $LOAD_PATH) && same_working_directory_for_load_path?
285
285
@expanded_load_path = $LOAD_PATH. map do |path |
286
286
path = Truffle ::Type . coerce_to_path ( path )
287
- unless @relative_path_in_load_path
287
+ unless @working_directory_copy
288
288
unless File . absolute_path? ( path )
289
289
@working_directory_copy = Primitive . working_directory
290
- @relative_path_in_load_path = true
291
290
end
292
291
end
293
292
Primitive . canonicalize_path ( path )
@@ -298,8 +297,8 @@ def self.get_expanded_load_path
298
297
end
299
298
300
299
def self . same_working_directory_for_load_path?
301
- if @relative_path_in_load_path
302
- if Primitive . working_directory == @ working_directory_copy
300
+ if working_directory_copy = @working_directory_copy
301
+ if Primitive . working_directory == working_directory_copy
303
302
true
304
303
else
305
304
@working_directory_copy = Primitive . working_directory
0 commit comments