~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
510
510
        self._write_config_file()
511
511
 
512
512
    def _write_config_file(self):
513
 
        f = open(self._get_filename(), 'wb')
 
513
        path = self._get_filename()
 
514
        f = osutils.open_with_ownership(path, 'wb')
514
515
        self._get_parser().write(f)
515
516
        f.close()
516
517
 
809
810
                trace.mutter('creating config parent directory: %r', parent_dir)
810
811
            os.mkdir(parent_dir)
811
812
        trace.mutter('creating config directory: %r', path)
812
 
        os.mkdir(path)
 
813
        osutils.mkdir_with_ownership(path)
813
814
 
814
815
 
815
816
def config_dir():
866
867
 
867
868
    This doesn't implicitly create it.
868
869
 
869
 
    On Windows it's in the config directory; elsewhere in the XDG cache directory.
 
870
    On Windows it's in the config directory; elsewhere it's /var/crash
 
871
    which may be monitored by apport.  It can be overridden by
 
872
    $APPORT_CRASH_DIR.
870
873
    """
871
874
    if sys.platform == 'win32':
872
875
        return osutils.pathjoin(config_dir(), 'Crash')
873
876
    else:
874
 
        return osutils.pathjoin(xdg_cache_dir(), 'crash')
 
877
        # XXX: hardcoded in apport_python_hook.py; therefore here too -- mbp
 
878
        # 2010-01-31
 
879
        return os.environ.get('APPORT_CRASH_DIR', '/var/crash')
875
880
 
876
881
 
877
882
def xdg_cache_dir():