Bug 476106 - Unable to get directory path for directories immediately under some symlinks. r=jmathies
authorRobert Strong <robert.bugzilla@gmail.com>
Thu, 05 Feb 2009 11:12:56 -0800
changeset 23145 89a76e45e282e6911ecc8b67369ba21bb99e01b8
parent 23144 b746930b1c179c1f55a6673e208a661e25ebfc91
child 23146 df442c0af61fa3a45fbefea201af00bbb265a149
child 23148 69d5afdba6c0d32b60d0f01580ed4d61dc2f35f2
push id620
push userrstrong@mozilla.com
push dateThu, 05 Feb 2009 19:13:22 +0000
reviewersjmathies
bugs476106
milestone1.9.1b3pre
Bug 476106 - Unable to get directory path for directories immediately under some symlinks. r=jmathies
browser/installer/windows/nsis/uninstaller.nsi
toolkit/mozapps/installer/windows/nsis/common.nsh
--- a/browser/installer/windows/nsis/uninstaller.nsi
+++ b/browser/installer/windows/nsis/uninstaller.nsi
@@ -554,17 +554,17 @@ FunctionEnd
 ################################################################################
 # Initialization Functions
 
 Function .onInit
   ${UninstallOnInitCommon}
 FunctionEnd
 
 Function un.onInit
-  GetFullPathName $INSTDIR "$INSTDIR\.."
+  ${un.GetParent} "$INSTDIR" $INSTDIR
   ${un.GetLongPath} "$INSTDIR" $INSTDIR
   ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
     Abort
   ${EndUnless}
 
   StrCpy $LANGUAGE 0
   ${un.SetBrandNameVars} "$INSTDIR\distribution\setup.ini"
 
--- a/toolkit/mozapps/installer/windows/nsis/common.nsh
+++ b/toolkit/mozapps/installer/windows/nsis/common.nsh
@@ -2176,26 +2176,19 @@
       Push $R8
       Push $R7
       Push $R6
       Push $R5
       Push $R4
 
       ClearErrors
 
-      StrCpy $R8 "$R9"
-      StrCpy $R9 ""
-      GetFullPathName $R8 "$R8"
+      GetFullPathName $R8 "$R9"
       IfErrors end_GetLongPath +1 ; If the path doesn't exist return an empty string.
 
-      ; Remove trailing \'s from the path.
-      StrCpy $R6 "$R8" "" -1
-      StrCmp $R6 "\" +1 +2
-      StrCpy $R9 "$R8" -1
-
       System::Call 'kernel32::GetLongPathNameW(w r18, w .r17, i 1024)i .r16'
       StrCmp "$R7" "" +4 +1 ; Empty string when GetLongPathNameW is not present.
       StrCmp $R6 0 +3 +1    ; Should never equal 0 since the path exists.
       StrCpy $R9 "$R7"
       GoTo end_GetLongPath
 
       ; Do it the hard way.
       StrCpy $R4 0     ; Stores the position in the string of the last \ found.
@@ -4614,16 +4607,17 @@
  */
 !macro UninstallOnInitCommon
 
   !ifndef UninstallOnInitCommon
     !insertmacro ElevateUAC
     !insertmacro GetLongPath
     !insertmacro GetOptions
     !insertmacro GetParameters
+    !insertmacro GetParent
     !insertmacro UnloadUAC
     !insertmacro UpdateUninstallLog
 
     !verbose push
     !verbose ${_MOZFUNC_VERBOSE}
     !define UninstallOnInitCommon "!insertmacro UninstallOnInitCommonCall"
 
     Function UninstallOnInitCommon
@@ -4634,17 +4628,17 @@
 
       ; Prevent launching the application when a reboot is required and this
       ; executable is the main application executable
       IfFileExists "$EXEDIR\${FileMainEXE}.moz-upgrade" +1 +4
       MessageBox MB_YESNO "$(WARN_RESTART_REQUIRED_UPGRADE)" IDNO +2
       Reboot
       Quit ; Nothing initialized so no need to call OnEndCommon
 
-      GetFullPathName $INSTDIR "$EXEDIR\.."
+      ${GetParent} "$EXEDIR" $INSTDIR
       ${GetLongPath} "$INSTDIR" $INSTDIR
       IfFileExists "$INSTDIR\${FileMainEXE}" +2 +1
       Quit ; Nothing initialized so no need to call OnEndCommon
 
 ; Prevents breaking apps that don't use SetBrandNameVars
 !ifdef SetBrandNameVars
       ${SetBrandNameVars} "$INSTDIR\distribution\setup.ini"
 !endif