mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
Ensure that functions like isDirectory don't fail if the file doesn't
exist but just return false instead. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22361 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -213,6 +213,8 @@ Path::isFile() const {
|
||||
|
||||
bool
|
||||
Path::isDirectory() const {
|
||||
if (!exists())
|
||||
return false;
|
||||
WIN32_FILE_ATTRIBUTE_DATA fi;
|
||||
if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
|
||||
ThrowError(std::string(path) + ": Can't get status: ");
|
||||
@@ -221,6 +223,8 @@ Path::isDirectory() const {
|
||||
|
||||
bool
|
||||
Path::isHidden() const {
|
||||
if (!exists())
|
||||
return false;
|
||||
WIN32_FILE_ATTRIBUTE_DATA fi;
|
||||
if (!GetFileAttributesEx(path.c_str(), GetFileExInfoStandard, &fi))
|
||||
ThrowError(std::string(path) + ": Can't get status: ");
|
||||
@@ -248,6 +252,8 @@ bool Path::hasMagicNumber(const std::string &Magic) const {
|
||||
|
||||
bool
|
||||
Path::isBytecodeFile() const {
|
||||
if (!isFile())
|
||||
return false;
|
||||
std::string actualMagic;
|
||||
if (!getMagicNumber(actualMagic, 4))
|
||||
return false;
|
||||
|
Reference in New Issue
Block a user