~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: John Arbash Meinel
  • Date: 2005-12-01 17:11:25 UTC
  • mto: (1185.50.19 bzr-jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1532.
  • Revision ID: john@arbash-meinel.com-20051201171125-5e1f0970246c4925
Updated the bzr sourcecode to use bzrlib.osutils.pathjoin rather than os.path.join to enforce internal use of / instead of \

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
 
61
61
import bzrlib
62
62
import bzrlib.errors as errors
 
63
from bzrlib.osutils import pathjoin
63
64
import bzrlib.util.configobj.configobj as configobj
64
65
from StringIO import StringIO
65
66
 
423
424
            base = os.environ.get('HOME', None)
424
425
        if base is None:
425
426
            raise BzrError('You must have one of BZR_HOME, APPDATA, or HOME set')
426
 
        return os.path.join(base, 'bazaar', '2.0')
 
427
        return pathjoin(base, 'bazaar', '2.0')
427
428
    else:
428
429
        # cygwin, linux, and darwin all have a $HOME directory
429
430
        if base is None:
430
431
            base = os.path.expanduser("~")
431
 
        return os.path.join(base, ".bazaar")
 
432
        return pathjoin(base, ".bazaar")
 
433
 
 
434
 
 
435
def ensure_config_dir_exists():
 
436
    """Make sure the configuration directory exists.
 
437
    On Windows, there is more than one level, so both must be created.
 
438
    """
 
439
    cd = config_dir()
 
440
    if os.path.exists(cd):
 
441
        return
 
442
    if sys.platform == 'win32':
 
443
        base = os.dirname(cd)
 
444
        if not os.path.exists(base):
 
445
            os.mkdir(base)
 
446
    os.mkdir(cd)
432
447
 
433
448
 
434
449
def config_filename():
435
450
    """Return per-user configuration ini file filename."""
436
 
    return os.path.join(config_dir(), 'bazaar.conf')
 
451
    return pathjoin(config_dir(), 'bazaar.conf')
437
452
 
438
453
 
439
454
def branches_config_filename():
440
455
    """Return per-user configuration ini file filename."""
441
 
    return os.path.join(config_dir(), 'branches.conf')
 
456
    return pathjoin(config_dir(), 'branches.conf')
442
457
 
443
458
 
444
459
def _auto_user_id():