コード例 #1
0
def is_hidden_win(fn):
    # Import that module here as it's not available on non-windows machines.
    # See http://bit.ly/i9klJE except that the attributes are defined in
    # win32file not win32com (bug on page).
    # Note: For some reason this doesn't work after a os.chdir(), no matter to
    #       what directory you change from where. Windows weirdness.
    from win32file import FILE_ATTRIBUTE_HIDDEN, GetFileAttributesEx
    attribs = GetFileAttributesEx(fn)
    return attribs[0] & FILE_ATTRIBUTE_HIDDEN
コード例 #2
0
def is_hidden_win(fn):
    if not _have_win32file:
        return False
    try:
        return GetFileAttributesEx(fn)[0] & FILE_ATTRIBUTE_HIDDEN
    except error:
        # This error can occured when a file is already accessed by someone
        # else. So don't return to True, because we have lot of chances to not
        # being able to do anything with it.
        Logger.exception('unable to access to <%s>' % fn)
        return True
コード例 #3
0
ファイル: filechooser.py プロジェクト: lanming/kivy
def is_hidden_win(fn):
    if not _have_win32file:
        return False
    try:
        return GetFileAttributesEx(fn)[0] & FILE_ATTRIBUTE_HIDDEN
    except error:
        # This error can occur when a file is already being accessed by someone
        # else. Return True because it's likely we will not be
        # able to do anything with it.
        Logger.exception('unable to access to <%s>' % fn)
        return True
コード例 #4
0
    def is_hidden(self, fn):
        if platform == 'win':
            if not _have_win32file:
                return False
            try:
                return GetFileAttributesEx(fn)[0] & FILE_ATTRIBUTE_HIDDEN
            except error:
                # This error can occured when a file is already accessed by
                # someone else. So don't return to True, because we have lot
                # of chances to not being able to do anything with it.
                Logger.exception('unable to access to <%s>' % fn)
                return True

        return basename(fn).startswith('.')