~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Jelmer Vernooij
  • Date: 2012-02-06 23:38:33 UTC
  • mfrom: (6463 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6464.
  • Revision ID: jelmer@samba.org-20120206233833-w0nbclw7d1xj4twj
merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
342
342
        raise errors.BadFilenameEncoding(val, _fs_enc)
343
343
 
344
344
 
 
345
def _posix_get_home_dir():
 
346
    """Get the home directory of the current user as a unicode path"""
 
347
    path = posixpath.expanduser("~")
 
348
    try:
 
349
        return path.decode(_fs_enc)
 
350
    except UnicodeDecodeError:
 
351
        raise errors.BadFilenameEncoding(path, _fs_enc)
 
352
 
 
353
 
345
354
def _posix_getuser_unicode():
346
355
    """Get username from environment or password database as unicode"""
347
356
    name = getpass.getuser()
448
457
pathjoin = os.path.join
449
458
normpath = _posix_normpath
450
459
path_from_environ = _posix_path_from_environ
 
460
_get_home_dir = _posix_get_home_dir
451
461
getuser_unicode = _posix_getuser_unicode
452
462
getcwd = os.getcwdu
453
463
rename = os.rename
511
521
    if f is not None:
512
522
        get_unicode_argv = f
513
523
    path_from_environ = win32utils.get_environ_unicode
 
524
    _get_home_dir = win32utils.get_home_location
514
525
    getuser_unicode = win32utils.get_user_name
515
526
 
516
527
elif sys.platform == 'darwin':