DoctorDeploy.com - Das unabhängige Forum für Installation und Softwareverteilung Your Ad Here    
Doctor Deploy: software deployment, - distribution, repackaging, msi, windows installer, client management, installation, setup : forum - discussion boards 
  Search   •  RSS/Newsletter   •  Shop   •  Register  •  Profile  •  Log in to check your private messages  •  Log in
 PATH Erweiterungen bei NSIS View next topic
View previous topic
Post new topicReply to topic
Author Message
bingen
Melchisedech
Melchisedech


Joined: 04 Jun 2004
Posts: 231
Location: 48°42' n.Br./09°09' ö.L.

PostPosted: Wed, 13.Apr.2005, 10:55 Back to top

NSIS (http://nsis.sourceforge.net/), einem schlanken installationssystem mit guten ansaetzen fehlt ein entscheidendes feature:
die erweiterung der PATH variable um das installationsverzeichnis.

hier mal eine loesung dafuer (sieht uebrigens nur kompliziert aus... Wink)

installation:
Code:

ReadRegStr $1 HKLM "SYSTEM\ControlSet001\Control\Session Manager\Environment" "Path"
    StrCpy $2 $1 1 -1 # copy last char
    StrCmp $2 ";" 0 +2 # if last char == ;
      StrCpy $1 $1 -1 # remove last char
    StrCmp $1 "" AddToPath_NTdoIt
      StrCpy $0 "$1;$INSTDIR"
    AddToPath_NTdoIt:
      WriteRegExpandStr HKLM "SYSTEM\ControlSet001\Control\Session Manager\Environment" "Path" $0


deinstallation:
Code:

ReadRegStr $1 HKLM "SYSTEM\ControlSet001\Control\Session Manager\Environment" "Path"
    StrCpy $5 $1 1 -1 # copy last char
    StrCmp $5 ";" +2 # if last char != ;
      StrCpy $1 "$1;" # append ;
    Push $1
    Push "$INSTDIR;"
    Call un.StrStr ; Find `$0;` in $1
    Pop $2 ; pos of our dir
    StrCmp $2 "" unRemoveFromPath_done
      ; else, it is in path
      # $0 - path to add
      # $1 - path var
      StrLen $3 "$INSTDIR;"
      StrLen $4 $2
      StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
      StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
      StrCpy $3 $5$6

      StrCpy $5 $3 1 -1 # copy last char
      StrCmp $5 ";" 0 +2 # if last char == ;
        StrCpy $3 $3 -1 # remove last char

      WriteRegExpandStr HKLM "SYSTEM\ControlSet001\Control\Session Manager\Environment" "Path" $3

unRemoveFromPath_done:


das ganze kann ganz einfach per copy&paste so verwendet werden.
View user's profileSend private message
AddThis Social Bookmark Button
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Service provided by flatbyte.com :: Powered by phpBB :: FI Theme :: Imprint :: All times are GMT + 1 Hour