~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/win32utils.py

  • Committer: Alexander Belchenko
  • Date: 2009-07-03 10:08:58 UTC
  • mto: (4506.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4507.
  • Revision ID: bialix@ukr.net-20090703100858-wz8hbr3514gd085l
Set hidden attribute on .bzr directory below unicode path should never fail with error. The operation should succeed even if bzr unable to set the attribute.  (related to bug #335362).

Show diffs side-by-side

added added

removed removed

Lines of Context:
66
66
        suffix = 'W'
67
67
try:
68
68
    import win32file
 
69
    import pywintypes
69
70
    has_win32file = True
70
71
except ImportError:
71
72
    has_win32file = False
499
500
def set_file_attr_hidden(path):
500
501
    """Set file attributes to hidden if possible"""
501
502
    if has_win32file:
502
 
        win32file.SetFileAttributes(path, win32file.FILE_ATTRIBUTE_HIDDEN)
 
503
        if winver != 'Windows 98':
 
504
            SetFileAttributes = win32file.SetFileAttributesW
 
505
        else:
 
506
            SetFileAttributes = win32file.SetFileAttributes
 
507
        try:
 
508
            SetFileAttributes(path, win32file.FILE_ATTRIBUTE_HIDDEN)
 
509
        except pywintypes.error, e:
 
510
            trace.mutter('Unable to set hidden attribute on %r: %s', path, e)
503
511
 
504
512
 
505
513
if has_ctypes and winver != 'Windows 98':