Skip to content

Commit

Permalink
Fix check for file type (crystal-lang#13760)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Oct 18, 2023
1 parent 9e625d5 commit 7d969a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions spec/compiler/crystal_path/crystal_path_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ describe Crystal::CrystalPath do
assert_finds "../test_folder", relative_to: "test_files/test_folder/file_three.cr", results: [
"test_files/test_folder/test_folder.cr",
]
assert_finds "foo.cr", results: [
"foo.cr/foo.cr",
]

# For `require "foo"`:
# 1. foo.cr (to find something in the standard library)
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion src/compiler/crystal/crystal_path.cr
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ module Crystal

each_file_expansion(filename, relative_to) do |path|
absolute_path = File.expand_path(path, dir: @current_dir)
return absolute_path if File.exists?(absolute_path)
return absolute_path if File.file?(absolute_path)
end

nil
Expand Down

0 comments on commit 7d969a4

Please sign in to comment.