From b4781cdf03fc43946b0e9f0686bce58083fe84cd Mon Sep 17 00:00:00 2001 From: YamaArashi Date: Fri, 8 Jan 2016 01:08:16 -0800 Subject: gpu_regs.c --- tools/scaninc/scaninc.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tools/scaninc/scaninc.cpp') diff --git a/tools/scaninc/scaninc.cpp b/tools/scaninc/scaninc.cpp index 803355f32..9a228180a 100644 --- a/tools/scaninc/scaninc.cpp +++ b/tools/scaninc/scaninc.cpp @@ -276,6 +276,17 @@ void AsmFile::SkipString() } } +bool CanOpenFile(std::string path) +{ + FILE *fp = fopen(path.c_str(), "rb"); + + if (fp == NULL) + return false; + + fclose(fp); + return true; +} + int main(int argc, char **argv) { if (argc < 2) @@ -296,7 +307,9 @@ int main(int argc, char **argv) while ((incDirectiveType = file.ReadUntilIncDirective(path)) != IncDirectiveType::None) { bool inserted = dependencies.insert(path).second; - if (inserted && incDirectiveType == IncDirectiveType::Include) + if (inserted + && incDirectiveType == IncDirectiveType::Include + && CanOpenFile(path)) filesToProcess.push(path); } } -- cgit v1.2.3