2010-07-23 3 views
0

나는 이것을 달성하기 위해 뭔가를 쓸 수 있었지만, 이미 뭔가가 있기를 바라고 있습니다. 그래도 Google에서는 아무 것도 발견하지 못했습니다..RC 파일에 의해 참조되지 않은 파일의 폴더를 확인하는 유틸리티는 무엇입니까?

Microsoft Windows Resource Compiler를 사용하여 컴파일 할 수있는 .RC 파일이 있습니다. .RC 파일을 분석하고 특정 폴더 집합 내의 파일이 현재이 파일에 의해 참조되지 않는 것을 파악할 수있는 기존 프로그램이 있는지 궁금합니다. 주로 내 자신의 사용

답변

0

신속하고 더러운 파이썬 유틸리티 :

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)