2011-10-24 3 views
1

현재 아래에 표시된 $ INSTDIR에있는 모든 텍스트 파일을 찾을 수 있습니다.NSIS 모든 .txt 파일 찾기

그러나 잠재적으로 추가 .txt 파일을 포함하는 $ INSTDIR \ mySub과 같은 하위 디렉터리가있을 수 있습니다. 유사한 루프 구조를 유지하지만 모든 하위 디렉토리를 검색하는 방법이 있습니까?

FindFirst $R0 $R1 "$INSTDIR\*.txt" 
IfErrors ExitInstaller 0 
LoopIt: 
    Messagebox MB_OK "Do some processing on $R1" 
    FindNext $R0 $R1 
    IfErrors 0 LoopIt 

답변

2
Function ProcessTextFiles 
Exch $0 
Push $1 
Push $2 
FindFirst $1 $2 "$0\*.txt" 
loop: 
    IfErrors end 
    DetailPrint 'Found "$0\$2"' 
    FindNext $1 $2 
    goto loop 
end: 
FindClose $1 
FindFirst $1 $2 "$0\*.*" 
dirloop: 
    IfErrors dirend 
    IfFileExists "$0\$2\*.*" 0 dirnext 
    StrCmp $2 "." dirnext 
    StrCmp $2 ".." dirnext 
    Push "$0\$2" 
    call ${__FUNCTION__} 
dirnext: 
    FindNext $1 $2 
    goto dirloop 
dirend: 
FindClose $1 
Pop $2 
Pop $1 
Pop $0 
FunctionEnd 

section 
push "$InstDir" 
call ProcessTextFiles 
sectionend 
+0

자동 모드에서 다른 점이 있습니까? http://stackoverflow.com/questions/8215733/nsis-find-files-in-silent-mode-not-working – jkh

1

대신 Locate 함수를 사용해보세요. 더 나은 해결책 일 수 있습니다. 하위 디렉토리 (또는 하위 디렉토리)를 찾고 마스크를 정의하는 옵션을 작성할 수 있습니다. doc 및 예제는 http://nsis.sourceforge.net/Locate을 참조하십시오.