开发者

Any Utilities to Check folder for files unreferenced by .RC file?

I could write something myself to accomplish this, but am hoping something already exists. I haven't found anything for it with Google, though.

I have a .RC file which I can compile using Microsoft Windows Resource Compiler. I am wondering if there are any existing programs which will analyze the .RC file and figure out what files within a particular set of 开发者_Python百科folders are currently not referenced by it.


Quick and Dirty python utility, mainly for my own use:

import os
import os.path

location = "C:\PATH\Resources\Stuff.rc"

loca = set([])
used = set([])
for root,dirs,files in os.walk(os.path.dirname(location)):
    for item in files:
        item = item.lower()
        if (item.endswith('.bmp')):
            loca.add(os.path.join(root.lower(),item))

with open(location) as rcfile:
    for line in rcfile:
        for token in line.split('"'):
            token = token.lower()
            if token.endswith('.bmp'):
                used.add(os.path.join(os.path.dirname(location).lower(),token.replace('\\\\','\\')))

print '\n'.join(loca - used)
print len(loca)
print len(used)
print len(loca - used)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜