问题:
I am trying to write a script which automatically checks out or updates a Subversion URL based on whether a specified directory exists or not.我正在尝试编写一个脚本,该脚本根据指定的目录是否存在自动检出或更新 Subversion URL。
For some reason, my code isn't working and always returns true even if it's false:出于某种原因,我的代码不起作用,即使它是假的,也总是返回真:
def directory_exists?(directory)
return false if Dir[directory] == nil
true
end
What am I doing wrong?我究竟做错了什么?
解决方案:
参考一: https://en.stackoom.com/question/4YJW参考二: https://stackoom.com/question/4YJW