forked from MyGUI/mygui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcount_lines.py
42 lines (34 loc) · 1.11 KB
/
count_lines.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python
# python 2.6 required (for os.path.relpath)
import os, filecmp
def countLines(fileName):
file = open(fileName, 'r')
count = 0
while file.readline() != "":
count = count + 1
file.close ()
return count
def CountLinesInFolder(dir_src):
numLines = 0
for root, dirs, files in os.walk(dir_src):
for name in files:
if name.endswith('.h') or name.endswith('.cpp'):
f_src = os.path.join(root, name)
f_src = f_src.replace('\\','/')
numLines = numLines + countLines(f_src)
print "" + dir_src + " : " + str(numLines)
return numLines
# ----------
i = 0
i += CountLinesInFolder('../MyGUIEngine')
i += CountLinesInFolder('../Demos')
i += CountLinesInFolder('../Tools')
i += CountLinesInFolder('../UnitTests')
i += CountLinesInFolder('../Common')
i += CountLinesInFolder('../Platforms/OpenGL')
i += CountLinesInFolder('../Platforms/OGRE')
i += CountLinesInFolder('../Platforms/DirectX')
i += CountLinesInFolder('../Plugins')
i += CountLinesInFolder('../Wrapper')
print "Total: "+ str(i)
raw_input("Press enter to continue.")