~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-10 14:53:51 UTC
  • mto: (1711.7.2 win32)
  • mto: This revision was merged to the branch mainline in revision 1796.
  • Revision ID: john@arbash-meinel.com-20060610145351-9da0c1f8ba8a57e0
the _posix_* routines should use posixpath not os.path, so tests pass on win32

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
from cStringIO import StringIO
20
20
import errno
 
21
from ntpath import (abspath as _nt_abspath,
 
22
                    join as _nt_join,
 
23
                    normpath as _nt_normpath,
 
24
                    realpath as _nt_realpath,
 
25
                    )
21
26
import os
22
27
from os import listdir
 
28
import posixpath
23
29
import re
24
30
import sha
25
31
import shutil
33
39
import types
34
40
import tempfile
35
41
import unicodedata
36
 
from ntpath import (abspath as _nt_abspath,
37
 
                    join as _nt_join,
38
 
                    normpath as _nt_normpath,
39
 
                    realpath as _nt_realpath,
40
 
                    )
41
42
 
42
43
import bzrlib
43
44
from bzrlib.errors import (BzrError,
198
199
# string.
199
200
_fs_enc = sys.getfilesystemencoding()
200
201
def _posix_abspath(path):
201
 
    return os.path.abspath(path.encode(_fs_enc)).decode(_fs_enc)
202
 
    # jam 20060426 This is another possibility which mimics 
203
 
    # os.path.abspath, only uses unicode characters instead
204
 
    # if not os.path.isabs(path):
205
 
    #     return os.path.join(os.getcwdu(), path)
206
 
    # return path
 
202
    # jam 20060426 rather than encoding to fsencoding
 
203
    # copy posixpath.abspath, but use os.getcwdu instead
 
204
    if not posixpath.isabs(path):
 
205
        path = posixpath.join(getcwd(), path)
 
206
    return posixpath.normpath(path)
207
207
 
208
208
 
209
209
def _posix_realpath(path):
210
 
    return os.path.realpath(path.encode(_fs_enc)).decode(_fs_enc)
 
210
    return posixpath.realpath(path.encode(_fs_enc)).decode(_fs_enc)
211
211
 
212
212
 
213
213
def _win32_abspath(path):