iwa*_*wan 221 ruby file
是否有一个Ruby类/方法,我可以传递"完整路径" home/me/a_file.txt,以确定它是否是一个有效的文件路径?
home/me/a_file.txt
zed*_*xff 559
# file? will only return true for files File.file?(filename)
和
# Will also return true for directories - watch out! File.exist?(filename)
Pau*_*ley 54
查看路径名,特别是Pathname#exist?.
Pathname#exist?
File及其FileTest模块可能更简单/更直接,但我发现Pathname一般的界面更好.
Pathname
归档时间:
14 年,5 月 前
查看次数:
183799 次
最近记录:
6 年,9 月 前