@@ -38,13 +38,21 @@ where
3838 // known. So the situation where a process only passes down `ProgramFiles` sometimes happens.
3939 let varname_current = "ProgramFiles" ;
4040
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+
4149 // 64-bit relative bin dirs. So far, this is always `mingw64` or `clangarm64`, not `urct64` or
4250 // `clang64`. We check `clangarm64` before `mingw64`, because in the strange case that both are
4351 // 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" ] [ .. ] ;
4553
4654 // 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" ] [ .. ] ;
4856
4957 // Whichever of the 64-bit or 32-bit relative bin better matches this process's architecture.
5058 // Unlike the system architecture, the process architecture is always known at compile time.
5361 #[ cfg( target_pointer_width = "32" ) ]
5462 let suffixes_current = suffixes_32;
5563
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+
5671 let rules = [
72+ ( varname_user_appdata_local, suffixes_user) ,
5773 ( varname_64bit, suffixes_64) ,
5874 ( varname_x86, suffixes_32) ,
5975 ( varname_current, suffixes_current) ,
0 commit comments