View Single Post
Old 23rd June 2010, 13:40   #7
Grytolle
Junior Member
 
Join Date: Jun 2010
Posts: 9
The above code example worked great for me, but now I realize that it detects the compressed size of my remote zip-files. Could anyone tell me how to detect the unzipped size without downloading the file, or is that not possible?

I turned Animaether's code into a macro, perhaps it could be of use to other beginners like me too:

code:
Usage: !insertmacro SetRemoteFileSize section url-of-remote-file

!macro SetRemoteFileSize sectie bestand
inetc::head /TIMEOUT 10000 ${bestand} "$EXEDIR\http.headers"
Pop $0
StrCmp $0 "OK" _ok${sectie} _error${sectie}
_error${sectie}:
MessageBox MB_OK "Non-fatal error! Could not detect file size of remote media $\"${sectie}$\"."
goto _end${sectie}
_ok${sectie}:
StrCpy $R0 -1
FileOpen $0 "$EXEDIR\http.headers" "r"
_nextline${sectie}:
ClearErrors
FileRead $0 $1
IfErrors _closeFile${sectie}
StrCpy $2 $1 16
StrCmp $2 "Content-Length: " _found${sectie} _nextline${sectie}
_found${sectie}:
StrCpy $R0 $1 "" 16
goto _closeFile${sectie}
_closeFile${sectie}:
FileClose $0
IntOp $R0 $R0 / 1024 ;SectionSize requires kilobytes
SectionSetSize ${${sectie}} $R0
_end${sectie}:
!macroend


Grytolle is offline   Reply With Quote