Changed getcwd to use NSFileManager.