swc-installation-test-2.py: Use ProgramFiles environment variable
On Fri, Apr 26, 2013 at 11:45:12AM -0700, Onno Broekmans wrote:
> ... the installation paths you mention are incorrect for the
> majority of modern Windows 7 installations. These are 64-bit
> installations, and they have a special folder for 32-bit programs:
> "C:\Program Files (x86)". So Notepad++ can be found in:
>
> C:\Program Files (x86)\Notepad++\notepad++.exe
>
> In the script, you could just check for the program's existence
> using both paths ("C:\Program Files" _and_ "C:\Program Files
> (x86)"), or you could use the "ProgramFiles" environment variable.
Environment variable it is! From the Microsoft docs [1]:
CSIDL_PROGRAM_FILESX86
The Program Files folder on 64-bit systems. A typical path is
C:\Program Files(86).
...
CSIDL_PROGRAM_FILES
Version 5.0. The Program Files folder. A typical path is
C:\Program Files.
...
PROGRAMFILES
Same as CSIDL_PROGRAM_FILES.
PROGRAMFILES(X86)
Refers to the C:\Program Files (x86) folder on 64-bit systems.
We're just looking for executables, so it would be ok if we found a
32-bit Notepad++ or a 64-bit Notepad++. With this commit, we check
both locations (if there are two distinct locations).
[1]: http://technet.microsoft.com/en-us/library/
cc749104%28v=ws.10%29.aspx