最佳答案
如果 Errno::ENOENT: No such file or directory
出现以下故障,即使该文件存在:
open('~/some_file')
不过,我可以这样做:
open(File.expand_path('~/some_file'))
我有两个问题:
open
不将波浪线处理为指向主目录?File.expand_path
更好的方法吗?