Where do I save my ruby (.rb) files? [duplicate]

一笑奈何 提交于 2019-12-27 03:35:27

问题


I am receiving the error No such file or directory in my command line and I think it's because I am not saving the ruby files somewhere specific. All I did was create a random folder where I would save my ruby files.

Do I need to save my scripts in the original ruby folder? Thanks!

** This is Windows 7.


回答1:


No, you can save your .rb files anywhere you can write. If you want to access a script no matter what your current directory, put the script in a directory that is part of your shell's PATH.

Are you comfortable using the shell on your machine? If not, you should learn a little about how to navigate directories, how commands are found, and the like. It will pay dividends.




回答2:


On Windows, depending on how your editor is set up, you may have the extension of .txt appended to your file, and so when you go to run Matz.rb it doesn't really exist, it is really `Matz.rb.txt.

This may or may not be happening with you, but a way to check is to open your command prompt, and do a dir in the folder to see what files you have there.



来源:https://stackoverflow.com/questions/18024309/where-do-i-save-my-ruby-rb-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!