From 3ce582f8a75c9d771ef8b58245e2965c2e768d6a Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Thu, 12 Mar 2015 19:58:09 -0700 Subject: [PATCH] Act as if unreadable files don't exist. This mainly affects Linux. If a file cannot be opened for reading, we should just return false for Exists(), since that will prevent us from trying to read from the file later. --- Core/Loaders.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Core/Loaders.cpp b/Core/Loaders.cpp index ca84309d1c..eaa028a3fd 100644 --- a/Core/Loaders.cpp +++ b/Core/Loaders.cpp @@ -237,8 +237,12 @@ LocalFileLoader::~LocalFileLoader() { } bool LocalFileLoader::Exists() { - FileInfo info; - return getFileInfo(filename_.c_str(), &info); + // If we couldn't open it for reading, we say it does not exist. + if (f_) { + FileInfo info; + return getFileInfo(filename_.c_str(), &info); + } + return false; } bool LocalFileLoader::IsDirectory() {