3件ヒット
[1-3件を表示]
(0.072秒)
検索結果
先頭3件
-
Dir
. home(user) -> String | nil (55006.0) -
現在のユーザまたは指定されたユーザのホームディレクトリを返します。
現在のユーザまたは指定されたユーザのホームディレクトリを返します。
Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。
//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}
@see File.expand_path -
Dir
. home -> String | nil (54706.0) -
現在のユーザまたは指定されたユーザのホームディレクトリを返します。
現在のユーザまたは指定されたユーザのホームディレクトリを返します。
Dir.home や Dir.home("root") は
File.expand_path("~") や File.expand_path("~root") と
ほぼ同じです。
//emlist[例][ruby]{
Dir.home # => "/home/vagrant"
Dir.home("root") # => "/root"
//}
@see File.expand_path -
File
. expand _ path(path , default _ dir = & # 39; . & # 39;) -> String (448.0) -
path を絶対パスに展開した文字列を返します。 path が相対パスであれば default_dir を基準にします。
path を絶対パスに展開した文字列を返します。
path が相対パスであれば default_dir を基準にします。
先頭の ~ はホームディレクトリ(環境変数 HOME が使われます)に、
~USER はそのユーザのホームディレクトリに展開されます。
//emlist[例][ruby]{
p Dir.getwd #=> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/h...