You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ah...@apache.org on 2006/10/28 23:46:04 UTC

svn commit: r468748 - /maven/maven-1/plugins/trunk/nsis/src/plugin-resources/Environment.nsh

Author: aheritier
Date: Sat Oct 28 14:46:04 2006
New Revision: 468748

URL: http://svn.apache.org/viewvc?view=rev&rev=468748
Log:
update script

Modified:
    maven/maven-1/plugins/trunk/nsis/src/plugin-resources/Environment.nsh

Modified: maven/maven-1/plugins/trunk/nsis/src/plugin-resources/Environment.nsh
URL: http://svn.apache.org/viewvc/maven/maven-1/plugins/trunk/nsis/src/plugin-resources/Environment.nsh?view=diff&rev=468748&r1=468747&r2=468748
==============================================================================
--- maven/maven-1/plugins/trunk/nsis/src/plugin-resources/Environment.nsh (original)
+++ maven/maven-1/plugins/trunk/nsis/src/plugin-resources/Environment.nsh Sat Oct 28 14:46:04 2006
@@ -1,15 +1,17 @@
-;
-; From NSISArchives http://nsis.sourceforge.net/archive/nsisweb.php?page=156&instances=0,11
-;
+!ifndef _WriteEnvStr_nsh
+!define _WriteEnvStr_nsh
+ 
 !include WinMessages.nsh
-
-!ifdef ALL_USERS
-  !define WriteEnvStr_RegKey \
-     'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
-!else
-  !define WriteEnvStr_RegKey 'HKCU "Environment"'
+ 
+!ifndef WriteEnvStr_RegKey
+  !ifdef ALL_USERS
+    !define WriteEnvStr_RegKey \
+       'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
+  !else
+    !define WriteEnvStr_RegKey 'HKCU "Environment"'
+  !endif
 !endif
-
+ 
 #
 # WriteEnvStr - Writes an environment variable
 # Note: Win9x systems requires reboot
@@ -24,7 +26,7 @@
   Exch
   Exch $0 ; $0 has environment variable name
   Push $2
-
+ 
   Call IsNT
   Pop $2
   StrCmp $2 1 WriteEnvStr_NT
@@ -36,18 +38,18 @@
     FileClose $2
     SetRebootFlag true
     Goto WriteEnvStr_done
-
+ 
   WriteEnvStr_NT:
       WriteRegExpandStr ${WriteEnvStr_RegKey} $0 $1
       SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
         0 "STR:Environment" /TIMEOUT=5000
-
+ 
   WriteEnvStr_done:
     Pop $2
-    Pop $1
     Pop $0
+    Pop $1
 FunctionEnd
-
+ 
 #
 # un.DeleteEnvStr - Removes an environment variable
 # Note: Win9x systems requires reboot
@@ -63,7 +65,7 @@
   Push $3
   Push $4
   Push $5
-
+ 
   Call un.IsNT
   Pop $1
   StrCmp $1 1 DeleteEnvStr_NT
@@ -74,7 +76,7 @@
     FileOpen $2 $4 w
     StrCpy $0 "SET $0="
     SetRebootFlag true
-
+ 
     DeleteEnvStr_dosLoop:
       FileRead $1 $3
       StrLen $5 $0
@@ -83,7 +85,7 @@
       StrCmp $5 "" DeleteEnvStr_dosLoopEnd
       FileWrite $2 $3
       Goto DeleteEnvStr_dosLoop
-
+ 
     DeleteEnvStr_dosLoopEnd:
       FileClose $2
       FileClose $1
@@ -92,12 +94,12 @@
       CopyFiles /SILENT $4 "$1\autoexec.bat"
       Delete $4
       Goto DeleteEnvStr_done
-
+ 
   DeleteEnvStr_NT:
     DeleteRegValue ${WriteEnvStr_RegKey} $0
     SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} \
       0 "STR:Environment" /TIMEOUT=5000
-
+ 
   DeleteEnvStr_done:
     Pop $5
     Pop $4
@@ -106,7 +108,10 @@
     Pop $1
     Pop $0
 FunctionEnd
-
+ 
+!ifndef IsNT_KiCHiK
+!define IsNT_KiCHiK
+ 
 #
 # [un.]IsNT - Pushes 1 if running on NT, 0 if not
 #
@@ -128,7 +133,7 @@
   Pop $0
   Push 0
   Return
-
+ 
   IsNT_yes:
     ; NT!!!
     Pop $0
@@ -137,3 +142,8 @@
 !macroend
 !insertmacro IsNT ""
 !insertmacro IsNT "un."
+ 
+!endif ; IsNT_KiCHiK
+ 
+!endif ; _WriteEnvStr_nsh 
+ 
\ No newline at end of file