diff --git a/query.py b/query.py index e24ffc6..b157f11 100755 --- a/query.py +++ b/query.py @@ -63,7 +63,7 @@ def query (cmd, *args): elif cmd == 'file': version = args[0] path = args[1] - ext = path[-2:] + ext = os.path.splitext(path)[1] if ext == '.c' or ext == '.h': tokens = scriptLines ('tokenize-file', version, path) diff --git a/update.py b/update.py index b5fb990..f78b997 100755 --- a/update.py +++ b/update.py @@ -74,7 +74,7 @@ def updateDefinitions (blobs): hash = db.hash.get (blob) filename = db.file.get (blob) - ext = filename[-2:] + ext = os.path.splitext(filename)[1] if not (ext == '.c' or ext == '.h'): continue lines = scriptLines ('parse-defs', hash, filename) @@ -97,7 +97,7 @@ def updateReferences (blobs): hash = db.hash.get (blob) filename = db.file.get (blob) - ext = filename[-2:] + ext = os.path.splitext(filename)[1] if not (ext == '.c' or ext == '.h'): continue tokens = scriptLines ('tokenize-file', '-b', hash)