Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Search ProgramW6432 and ProgramFiles(x86) for R #11

Merged
merged 2 commits into from
Jul 10, 2014

Conversation

wking
Copy link
Contributor

@wking wking commented Jul 9, 2014

Possible fix for #7.

wking added 2 commits July 9, 2014 11:34
This is the default for when ProgramFiles isn't set.  Windows
operating systems should always have that environment variable set, so
the default is probably only useful when you're testing the script on
a non-Windows system.
It turns out that the 'ProgramFiles' environment variable is set
differently depending on the architecture of process in question.  To
always get the 32-bit x86 version, you should use 'ProgramFiles(x86)'
[1].  To always get the 64-bit amd64 version, you should use
'ProgramW6432' [2].

To be safe, and support both 32- and 64-bit Windows installs, just
search everything that could be relevant.  Prefer 64-bit locations
(when we have any).

[1]: http://technet.microsoft.com/en-us/library/cc749104%28v=ws.10%29.aspx
     Recognized Environment Variables
     ...
     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.

[2]: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384274%28v=vs.85%29.aspx#Environment_Variables
     WOW64 Implementation Details
     ...
     64-bit process:
        ProgramFiles=%ProgramFiles%
        ProgramW6432=%ProgramFiles%
     32-bit process:
        ProgramFiles=%ProgramFiles(x86)%
        ProgramW6432=%ProgramFiles%

     The ProgramW6432 and CommonProgramW6432 environment variables
     were added starting with Windows 7 and Windows Server 2008 R2.
@wking wking merged commit 23d9af6 into swcarpentry:python Jul 10, 2014
@wking wking deleted the r-path-arch branch July 10, 2014 19:40
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant