@@ -38,13 +38,21 @@ where
38
38
// known. So the situation where a process only passes down `ProgramFiles` sometimes happens.
39
39
let varname_current = "ProgramFiles" ;
40
40
41
+ // Should give the user's local application data path on any system. If a user program files
42
+ // directory exists for this user, then it should be the `Programs` subdirectory of this. If it
43
+ // doesn't exist, or on a future or extremely strangely configured Windows setup where it is
44
+ // somewhere else, it should still be safe to attempt to use it. (This differs from global
45
+ // program files paths, which are usually subdirectories of the root of the system drive, which
46
+ // limited user accounts can usually create their own arbitrarily named directories inside.)
47
+ let varname_user_appdata_local = "LocalAppData" ;
48
+
41
49
// 64-bit relative bin dirs. So far, this is always `mingw64` or `clangarm64`, not `urct64` or
42
50
// `clang64`. We check `clangarm64` before `mingw64`, because in the strange case that both are
43
51
// available, we don't want to skip over a native ARM64 executable for an emulated x86_64 one.
44
- let suffixes_64 = [ r"Git\clangarm64\bin" , r"Git\mingw64\bin" ] . as_slice ( ) ;
52
+ let suffixes_64 = & [ r"Git\clangarm64\bin" , r"Git\mingw64\bin" ] [ .. ] ;
45
53
46
54
// 32-bit relative bin dirs. So far, this is only ever `mingw32`, not `clang32`.
47
- let suffixes_32 = [ r"Git\mingw32\bin" ] . as_slice ( ) ;
55
+ let suffixes_32 = & [ r"Git\mingw32\bin" ] [ .. ] ;
48
56
49
57
// Whichever of the 64-bit or 32-bit relative bin better matches this process's architecture.
50
58
// Unlike the system architecture, the process architecture is always known at compile time.
53
61
#[ cfg( target_pointer_width = "32" ) ]
54
62
let suffixes_current = suffixes_32;
55
63
64
+ // Bin dirs relative to a user's local application data directory. We try each architecture.
65
+ let suffixes_user = & [
66
+ r"Programs\Git\clangarm64\bin" ,
67
+ r"Programs\Git\mingw64\bin" ,
68
+ r"Programs\Git\mingw32\bin" ,
69
+ ] [ ..] ;
70
+
56
71
let rules = [
72
+ ( varname_user_appdata_local, suffixes_user) ,
57
73
( varname_64bit, suffixes_64) ,
58
74
( varname_x86, suffixes_32) ,
59
75
( varname_current, suffixes_current) ,
0 commit comments