From 38be374d0a59512e4d5cd282b9910bf9630e0a93 Mon Sep 17 00:00:00 2001 From: yenatch Date: Wed, 11 Sep 2013 19:17:25 -0400 Subject: [PATCH] check that a source file exists before scanning it for includes --- scan_includes.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scan_includes.py b/scan_includes.py index 3f006998c..0abd3084a 100644 --- a/scan_includes.py +++ b/scan_includes.py @@ -5,15 +5,17 @@ Recursively scan an asm file for rgbasm INCLUDEs and INCBINs. This is used to generate dependencies for each rgbasm object file. """ +import os import sys def scan_for_includes(filename): filenames = [] - for line in open(filename, 'r').readlines(): - if 'INCLUDE' in line or 'INCBIN' in line: - line = line.split(';')[0] + if os.path.exists(filename): + for line in open(filename, 'r').readlines(): if 'INCLUDE' in line or 'INCBIN' in line: - filenames += [line.split('"')[1]] + line = line.split(';')[0] + if 'INCLUDE' in line or 'INCBIN' in line: + filenames += [line.split('"')[1]] return filenames def recursive_scan_for_includes(filename):