~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-12 19:14:41 UTC
  • mfrom: (5598.2.2 2.3-unicode-home)
  • Revision ID: pqm@pqm.ubuntu.com-20110112191441-mvbtkj06k4rkmifl
(jameinel) Decode config_dir() environment variables on Windows using 'mbcs'
 (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#            and others
4
4
#
1131
1131
    """
1132
1132
    base = os.environ.get('BZR_HOME', None)
1133
1133
    if sys.platform == 'win32':
 
1134
        # environ variables on Windows are in user encoding/mbcs. So decode
 
1135
        # before using one
 
1136
        if base is not None:
 
1137
            base = base.decode('mbcs')
1134
1138
        if base is None:
1135
1139
            base = win32utils.get_appdata_location_unicode()
1136
1140
        if base is None:
1137
1141
            base = os.environ.get('HOME', None)
 
1142
            if base is not None:
 
1143
                base = base.decode('mbcs')
1138
1144
        if base is None:
1139
1145
            raise errors.BzrError('You must have one of BZR_HOME, APPDATA,'
1140
1146
                                  ' or HOME set')