StripPath for Winamp: Difference between revisions
From NSIS Wiki
Jump to navigationJump to search
m (Updated author and download links, and changed format of some pages.) |
m (Updated author links.) |
||
Line 1: | Line 1: | ||
{|align=right | |||
|<small>Author: [[{{ns:2}}:jan|jan]] ([[{{ns:3}}:jan|talk]], [[{{ns:-1}}:Contributions/jan|contrib]])</small> | |||
|} | |||
<br style="clear:both;"> | |||
== Description == | == Description == | ||
The only way to detect the installation path of Winamp leads to reading the UninstallString, which points to an .EXE file. This function uses this executable as $INSTDIR, call this function to get the path name. | The only way to detect the installation path of Winamp leads to reading the UninstallString, which points to an .EXE file. This function uses this executable as $INSTDIR, call this function to get the path name. | ||
Line 39: | Line 43: | ||
FunctionEnd | FunctionEnd | ||
</highlight-nsis> | </highlight-nsis> | ||
Revision as of 03:04, 30 April 2005
Author: jan (talk, contrib) |
Description
The only way to detect the installation path of Winamp leads to reading the UninstallString, which points to an .EXE file. This function uses this executable as $INSTDIR, call this function to get the path name.
The Function
;StripPath function by Frank Nagel Function StripPath Push $1 Push $2 StrCmp $INSTDIR "" fin StrCpy $1 $INSTDIR 1 0 ; get firstchar StrCmp $1 '"' "" getparent ; if first char is ", let's remove "'s first. StrCpy $INSTDIR $INSTDIR "" 1 StrCpy $1 0 rqloop: StrCpy $2 $INSTDIR 1 $1 StrCmp $2 '"' rqdone StrCmp $2 "" rqdone IntOp $1 $1 + 1 Goto rqloop rqdone: StrCpy $INSTDIR $INSTDIR $1 getparent: ; the uninstall string goes to an EXE, let's get the directory. StrCpy $1 -1 gploop: StrCpy $2 $INSTDIR 1 $1 StrCmp $2 "" gpexit StrCmp $2 "\" gpexit IntOp $1 $1 - 1 Goto gploop gpexit: StrCpy $INSTDIR $INSTDIR $1 fin: Pop $2 Pop $1 FunctionEnd