我尝试了以下帮助我看到的方法1-level down directory path
:
E:\WIPData\Ruby\Scripts>irb
irb(main):001:0> Dir.pwd
=> "E:/WIPData/Ruby/Scripts"
irb(main):004:0> Dir.pwd.gsub(/\/Scripts/,'')
=> "E:/WIPData/Ruby"
irb(main):005:0>
有没有办法从当前目录获取directory full path
1-level up和1-level down而不更改它?
File structure
=================
Dir-> E:\WIPData\
|
(E:\WIPData\Ruby)
|
--------------------------------------------------
| | | | |
(xxx) (yyyy) (zzzz) (pppp) (E:\WIPData\Ruby\Scripts) <= It is PWD