Skip to content

Commit

Permalink
Convert the argument to File.realpath with #to_path
Browse files Browse the repository at this point in the history
* Fixes #1894
  • Loading branch information
eregon committed Feb 7, 2020
1 parent 466d89f commit 8023c76
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Compatibility:
* Implemented `Dir#each_child`.
* Implemented `Kernel.{chomp, chop}` and `Kernel#{chomp, chop}`.
* Implemented `-p` and `-a`, and `-l` CLI options.
* Convert the argument to `File.realpath` with `#to_path` (#1894).

Changes:

Expand Down
2 changes: 2 additions & 0 deletions src/main/ruby/truffleruby/core/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,8 @@ def self.readlink(path)
end

def self.realpath(path, basedir = nil)
path = Truffle::Type.coerce_to_path(path)

unless absolute_path?(path)
path = expand_path(path, basedir)
end
Expand Down

0 comments on commit 8023c76

Please sign in to comment.