phabricator: look for .arcrc in the correct location on Windows

Summary:
On Windows `arc install-certificate` writes the cert to APPDATA:
https://fburl.com/i7fpssf8, so that is where we need to look for it.

Test Plan: - make this change, see that `hg ssl` shows commit status locally

Reviewers: davidsp, andrasbelo, #sourcecontrol

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4962334

Tasks: 17511545
This commit is contained in:
Kostia Balytskyi 2017-04-27 09:01:15 -07:00
parent 05d97a9461
commit b331423be1

View File

@ -26,9 +26,14 @@ def _load_file(filename):
raise
def load_for_path(path):
homedir = os.getenv('HOME')
# location where `arc install-certificate` writes .arcrc
if os.name == 'nt':
envvar = 'APPDATA'
else:
envvar = 'HOME'
homedir = os.getenv(envvar)
if not homedir:
raise ArcConfigError('$HOME environment variable not found')
raise ArcConfigError('$%s environment variable not found' % envvar)
# Use their own file as a basis
userconfig = _load_file(os.path.join(homedir, '.arcrc')) or {}