GetExePath: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Added category links.) |
m (Updated by user: Instructor (talk, contrib).) |
||
Line 7: | Line 7: | ||
: http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost | : http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost | ||
If function used without header | If a function is used without an header, you should put the function below in your script before calling it. | ||
== The Function == | == The Function == | ||
Line 16: | Line 16: | ||
____________________________________________________________________________ | ____________________________________________________________________________ | ||
Get installer pathname ($EXEDIR with valid case for Windows 9X). | |||
Get installer pathname ($EXEDIR with valid case for Windows 9X) | |||
Syntax: | Syntax: | ||
${GetExePath} $var | |||
Example: | Example: | ||
Section | Section | ||
${GetExePath} $R0 | |||
; $R0="C:\ftp" | |||
SectionEnd*/ | SectionEnd*/ | ||
;--------------------------------------------------------------------------- | ;--------------------------------------------------------------------------- | ||
Function GetExePath | Function GetExePath | ||
!define GetExePath `!insertmacro GetExePathCall` | |||
!macro GetExePathCall _RESULT | |||
Call GetExePath | |||
Pop ${_RESULT} | |||
!macroend | |||
Push $0 | Push $0 | ||
Push $1 | Push $1 |
Revision as of 09:39, 24 June 2005
Author: Instructor (talk, contrib) |
Links
- Latest version of headers "nsh.zip"
- http://forums.winamp.com/showthread.php?s=&threadid=203228&goto=lastpost
If a function is used without an header, you should put the function below in your script before calling it.
The Function
/* ____________________________________________________________________________ GetExePath ____________________________________________________________________________ Get installer pathname ($EXEDIR with valid case for Windows 9X). Syntax: ${GetExePath} $var Example: Section ${GetExePath} $R0 ; $R0="C:\ftp" SectionEnd*/ ;--------------------------------------------------------------------------- Function GetExePath !define GetExePath `!insertmacro GetExePathCall` !macro GetExePathCall _RESULT Call GetExePath Pop ${_RESULT} !macroend Push $0 Push $1 Push $2 StrCpy $1 $CMDLINE 1 StrCmp $1 '"' 0 exedir StrCpy $1 0 IntOp $1 $1 + 1 StrCpy $0 $CMDLINE 1 $1 StrCmp $0 '"' 0 -2 IntOp $1 $1 - 1 StrCpy $0 $CMDLINE $1 1 StrCpy $1 0 IntOp $1 $1 - 1 StrCpy $2 $0 1 $1 StrCmp $2 '\' 0 -2 StrCpy $0 $0 $1 goto end exedir: StrCpy $0 $EXEDIR end: Pop $2 Pop $1 Exch $0 FunctionEnd