Skip to content

Commit

Permalink
* Add a couple of checks on inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattball committed Apr 23, 2009
1 parent b61a213 commit 65002e9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions doxyclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ def _mkdir(newdir):
os.mkdir(newdir)

def fileIsDocumented(filePath):
# Only XML files can contain documentation information
if not os.path.splitext(filePath)[1] == ".xml":
return False

# Check if the object is documented
originaldoc = minidom.parse(filePath)
briefList = originaldoc.getElementsByTagName('briefdescription')
Expand All @@ -64,10 +68,16 @@ def fileIsDocumented(filePath):
return False

def nameForFile(filePath):
if not os.path.splitext(filePath)[1] == ".xml":
return None

xmlDoc = minidom.parse(filePath)
return xmlDoc.getElementsByTagName("name")[0].firstChild.data

def typeForFile(filePath):
if not os.path.splitext(filePath)[1] == ".xml":
return None

xmlDoc = minidom.parse(filePath)
return xmlDoc.getElementsByTagName("object")[0].attributes["kind"].value

Expand Down Expand Up @@ -111,6 +121,10 @@ def createIndexXML(directory):
# Add one element per file
for (path, dirs, files) in os.walk(directory):
for fileName in files:
# Only look at XML files
if not os.path.splitext(fileName)[1] == ".xml":
continue

# Get information about the file
filePath = os.path.join(path, fileName)
objectName = nameForFile(filePath)
Expand Down Expand Up @@ -141,8 +155,8 @@ def linkify(directory):
# Get each file
for (path, dirs, files) in os.walk(directory):
for fileName in files:
# Skip the index
if fileName == "index.xml":
# Skip the index and any non-xml files
if fileName == "index.xml" or not os.path.splitext(fileName)[1] == ".xml":
continue

filePath = os.path.join(path, fileName)
Expand Down

0 comments on commit 65002e9

Please sign in to comment.