StripPath for Winamp
From NSIS Wiki
Jump to navigationJump to search
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