Bug 1510276 - Fix GetLongPath so it returns the proper case for the path. r=mhowell
authorRobert Strong <robert.bugzilla@gmail.com>
Mon, 04 Mar 2019 18:22:54 +0000
changeset 520134 a9bb4a23d4072a2735b50b577f9668728af06d30
parent 520133 ed6397d7e51a7e9084281d2a8b33b0c5e8eeedb7
child 520136 8602628e7edaecadea855a64179b329da6ff1f20
child 520137 8f8fffb64cd134c4fc468c4d020ae9c5e199f304
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhowell
bugs1510276
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1510276 - Fix GetLongPath so it returns the proper case for the path. r=mhowell Always uppercase the first char of the path in GetLongPath Remove GetLongPathNameW since it isn't setting the proper case for the path segments below the leaf name Differential Revision: https://phabricator.services.mozilla.com/D21873
toolkit/mozapps/installer/windows/nsis/common.nsh
--- a/toolkit/mozapps/installer/windows/nsis/common.nsh
+++ b/toolkit/mozapps/installer/windows/nsis/common.nsh
@@ -2322,21 +2322,22 @@
       Push $R5
       Push $R4
 
       ClearErrors
 
       GetFullPathName $R8 "$R9"
       IfErrors end_GetLongPath +1 ; If the path doesn't exist return an empty string.
 
-      System::Call 'kernel32::GetLongPathNameW(w R8, w .R7, i 1024)i .R6'
-      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
+      ; Make the drive letter uppercase.
+      StrCpy $R9 "$R8" 1    ; Copy the first char.
+      StrCpy $R8 "$R8" "" 1 ; Copy everything after the first char.
+      ; Convert the first char to uppercase.
+      System::Call "User32::CharUpper(w R9 R9)i"
+      StrCpy $R8 "$R9$R8"   ; Copy the uppercase char and the rest of the chars.
 
       ; Do it the hard way.
       StrCpy $R4 0     ; Stores the position in the string of the last \ found.
       StrCpy $R6 -1    ; Set the counter to -1 so it will start at 0.
 
       loop_GetLongPath:
       IntOp $R6 $R6 + 1      ; Increment the counter.
       StrCpy $R7 $R8 1 $R6   ; Starting from the counter copy the next char.