Push instead of writing to $0
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2158 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
835461d69a
commit
a5257b1d26
3 changed files with 7 additions and 8 deletions
|
@ -18,25 +18,24 @@
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
3. This notice may not be removed or altered from any source distribution.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
This dll can be used from NSIS to download files via http.
|
This dll can be used from NSIS to download files via http.
|
||||||
|
|
||||||
How to use (for another example, see waplugin.nsi in the nsis directory):
|
How to use (for another example, see waplugin.nsi in the nsis directory):
|
||||||
|
|
||||||
You can also pass /TIMEOUT=### to set the timeout in milliseconds
|
You can also pass /TIMEOUT=### to set the timeout in milliseconds
|
||||||
Result is returned in $0
|
Result is pushed to the stack
|
||||||
"cancel" if cancelled
|
"cancel" if cancelled
|
||||||
"success" if success
|
"success" if success
|
||||||
otherwise, an error string describing the error
|
otherwise, an error string describing the error
|
||||||
|
|
||||||
NSISdl::download http://www.nullsoft.com/free/nsis/nsis198.exe poo.exe
|
NSISdl::download http://www.nullsoft.com/free/nsis/nsis198.exe poo.exe
|
||||||
or
|
or
|
||||||
NSISdl::download /TIMEOUT=30000 http://www.nullsoft.com/free/nsis/nsis198.exe poo.exe
|
NSISdl::download /TIMEOUT=30000 http://www.nullsoft.com/free/nsis/nsis198.exe poo.exe
|
||||||
|
|
||||||
|
|
||||||
then, check $0 for errors:
|
then, pop a value from the stack and for errors:
|
||||||
|
|
||||||
|
Pop $0
|
||||||
StrCmp $0 "success" yay
|
StrCmp $0 "success" yay
|
||||||
Abort "Error downloading file
|
Abort "Error downloading file
|
||||||
yay:
|
yay:
|
||||||
|
|
|
@ -393,13 +393,13 @@ __declspec(dllexport) void download (HWND parent,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_cancelled) {
|
if (g_cancelled) {
|
||||||
setuservariable(INST_0, "cancel");
|
pushstring("cancel");
|
||||||
DeleteFile(filename);
|
DeleteFile(filename);
|
||||||
} else if (error == NULL) {
|
} else if (error == NULL) {
|
||||||
setuservariable(INST_0, "success");
|
pushstring("success");
|
||||||
} else {
|
} else {
|
||||||
DeleteFile(filename);
|
DeleteFile(filename);
|
||||||
setuservariable(INST_0, error);
|
pushstring(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete get;
|
delete get;
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue