forked from BelledonneCommunications/linphone-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_unused_resources.py
executable file
·30 lines (27 loc) · 1.31 KB
/
check_unused_resources.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
#!/usr/bin/env python
import os
import subprocess
for filename in os.listdir('res/drawable-xhdpi/'):
resourcename = os.path.splitext(filename)[0]
if resourcename[-2:] == '.9':
resourcename = resourcename[:-2]
p = subprocess.Popen(['grep', '-nr', 'R.drawable.' + resourcename, 'src/'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if str(out) is "":
p = subprocess.Popen(['grep', '-nr', '@drawable/' + resourcename, 'res/'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if str(out) is "":
#os.remove('res/drawable-xhdpi/' + filename)
print 'Unused file : ' + filename
for filename in os.listdir('res/drawable/'):
resourcename = os.path.splitext(filename)[0]
if resourcename[-2:] == '.9':
resourcename = resourcename[:-2]
p = subprocess.Popen(['grep', '-nr', 'R.drawable.' + resourcename, 'src/'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if str(out) is "":
p = subprocess.Popen(['grep', '-nr', '@drawable/' + resourcename, 'res/'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
if str(out) is "":
#os.remove('res/drawable/' + filename)
print 'Unused file : ' + filename