るりまサーチ (Ruby 2.5.0)

最速Rubyリファレンスマニュアル検索!
2件ヒット [1-2件を表示] (0.026秒)
トップページ > クラス:File[x] > バージョン:2.5.0[x] > クエリ:File.expand_path[x]

別のキーワード

  1. argf.class lines
  2. argf.class each
  3. argf.class each_line
  4. argf.class gets
  5. argf.class to_a

ライブラリ

キーワード

検索結果

File.expand_path(path, default_dir = '.') -> String (69076.0)

path を絶対パスに展開した文字列を返します。 path が相対パスであれば default_dir を基準にします。

...> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/home/matz/work"
p File.expand_path("..", "/tmp") #=> "/"
p File.expand_path("~") #=> "/home/matz"
p File.expand_path("~foo") #=> "/home/foo"
//}

@param path パスを表...

File.absolute_path(file_name, dir_string=nil) -> String (40.0)

file_name を絶対パスに変換した文字列を返します。

...
file
_name を絶対パスに変換した文字列を返します。

相対パスの場合はカレントディレクトリを基準とします。
dir_string を渡した場合はそのディレクトリを基準とします。

File
.expand_path と異なり、 file_name 先頭が "~" である場...
...ME"] #=> "/home/matz"
p File.absolute_path("..") #=> "/home/matz/work"
p File.absolute_path("..", "/tmp") #=> "/"
p File.absolute_path("~") #=> "/home/matz/work/bar/~"
p File.absolute_path("~foo") #=> "/home/matz/work/bar/~foo"
//}

@see File.expand_path...