I am getting confused with the utility of the File Class
methods as below:
1. File::absolute_path
2. File::realdirpath
3. File::realpath
4. File::expand_path
What I tried below:
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>
Questions:
- Why
File.realdirpath
andFile.realpath
produces the same output? - How
File.realpath
differs fromFile.absolute_path
? - How does
absolute_path(file_nam)
differ fromabsolute_path(file_name[, dir_string] )
? - How does
realdirpath(pathname)
differ fromrealdirpath(pathname [, dir_string])
?
~
" is in a path? If not, find out. What does "..
" do in a path? Those are things that affect the output of those methods.