We are working on converting the wiki to a static website controlled by markdown files in https://github.com/nsis-community. You can already see there how plug-ins will be posted. The end-user interface will still be a website but with a fresh coat of paint. Come meet us at Discord to talk about it.

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