私はFile Class
以下のようなメソッドの有用性と混同しています:
1. File::absolute_path
2. File::realdirpath
3. File::realpath
4. File::expand_path
私が以下で試したこと:
irb(main):001:0> Dir.pwd
=> "C:/Users/Matt"
irb(main):002:0> Dir.chdir('D:\VB Script\excel_ie_wsh')
=> 0
irb(main):003:0> Dir.pwd
=> "D:/VB Script/excel_ie_wsh"
irb(main):005:0> File.realdirpath('\VB Script\excel_ie_wsh')
=> "/VB Script/excel_ie_wsh"
irb(main):006:0> File.realpath('\VB Script\excel_ie_wsh')
=> "/VB Script/excel_ie_wsh"
irb(main):007:0> File.absolute_path('\VB Script\excel_ie_wsh')
=> "D:/VB Script/excel_ie_wsh"
irb(main):008:0> File.realpath('readme.txt')
=> "D:/VB Script/excel_ie_wsh/readme.txt"
irb(main):009:0> File.realdirpath('readme.txt')
=> "D:/VB Script/excel_ie_wsh/readme.txt"
irb(main):012:0> File.absolute_path('readme.txt')
=> "D:/VB Script/excel_ie_wsh/readme.txt"
irb(main):013:0>
質問:
- なぜ、同じ出力
File.realdirpath
を生成しますか?File.realpath
- とどう
File.realpath
違うのFile.absolute_path
? - とどう
absolute_path(file_nam)
違うのabsolute_path(file_name[, dir_string] )
? - とどう
realdirpath(pathname)
違うのrealdirpath(pathname [, dir_string])
?