how to get the current working directory's absolute path from irb

后端 未结 6 1825
一向
一向 2021-01-29 18:54

I\'m running Ruby on Windows though I don\'t know if that should make a difference. All I want to do is get the current working directory\'s absolute path. Is this possible fr

6条回答
  •  暖寄归人
    2021-01-29 19:13

    File.expand_path File.dirname(__FILE__) will return the directory relative to the file this command is called from.

    But Dir.pwd returns the working directory (results identical to executing pwd in your terminal)

提交回复
热议问题