GetExePath: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Adding new author and category links.) |
Instructor (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{PageAuthor|Instructor}} | {{PageAuthor|Instructor}} | ||
{{User:Instructor/Headers/Template}} | |||
== Function Description == | |||
<highlight-nsis> | |||
<highlight-nsis> | |||
____________________________________________________________________________ | ____________________________________________________________________________ | ||
Line 15: | Line 12: | ||
Get installer pathname ($EXEDIR with valid case for Windows | Get installer pathname ($EXEDIR with valid case for Windows 98/Me). | ||
Syntax: | Syntax: | ||
${GetExePath} $var | ${GetExePath} $var | ||
</highlight-nsis> | |||
Example: | <b>Example:</b> | ||
Section | <highlight-nsis>Section | ||
${GetExePath} $R0 | ${GetExePath} $R0 | ||
; $R0="C:\ftp" | ; $R0="C:\ftp" | ||
SectionEnd | SectionEnd | ||
</highlight-nsis> | |||
== Function Code == | |||
<highlight-nsis> | |||
Function GetExePath | Function GetExePath | ||
!define GetExePath `!insertmacro GetExePathCall` | !define GetExePath `!insertmacro GetExePathCall` | ||
Line 42: | Line 41: | ||
Push $1 | Push $1 | ||
Push $2 | Push $2 | ||
StrCpy $0 $EXEDIR | StrCpy $0 $EXEDIR | ||
System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2' | |||
StrCmp $2 error +2 | |||
StrCpy $0 $1 | |||
Pop $2 | Pop $2 | ||
Pop $1 | Pop $1 |
Latest revision as of 12:11, 30 November 2005
Author: Instructor (talk, contrib) |
Page for NSIS 2.07 and below users
You can use the latest version of headers (recommended) or the following function code (put the function code in your script before calling it)
Function Description
____________________________________________________________________________ GetExePath ____________________________________________________________________________ Get installer pathname ($EXEDIR with valid case for Windows 98/Me). Syntax: ${GetExePath} $var
Example:
Section ${GetExePath} $R0 ; $R0="C:\ftp" SectionEnd
Function Code
Function GetExePath !define GetExePath `!insertmacro GetExePathCall` !macro GetExePathCall _RESULT Call GetExePath Pop ${_RESULT} !macroend Push $0 Push $1 Push $2 StrCpy $0 $EXEDIR System::Call 'kernel32::GetLongPathNameA(t r0, t .r1, i 1024)i .r2' StrCmp $2 error +2 StrCpy $0 $1 Pop $2 Pop $1 Exch $0 FunctionEnd