問題:
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