From 3527ed2dda4af08145131ee01a515f553774e0c6 Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Sun, 18 Feb 2018 08:17:49 +0100 Subject: [PATCH] Changed file entry type to public attribute #52 --- dfvfs/vfs/bde_file_entry.py | 2 +- dfvfs/vfs/compressed_stream_file_entry.py | 4 +-- dfvfs/vfs/cpio_file_entry.py | 16 +++++----- dfvfs/vfs/encoded_stream_file_entry.py | 4 +-- dfvfs/vfs/encrypted_stream_file_entry.py | 4 +-- dfvfs/vfs/fake_file_entry.py | 4 +-- dfvfs/vfs/file_entry.py | 37 +++++++++++++---------- dfvfs/vfs/fvde_file_entry.py | 2 +- dfvfs/vfs/gzip_file_entry.py | 2 +- dfvfs/vfs/lvm_file_entry.py | 6 ++-- dfvfs/vfs/ntfs_file_entry.py | 6 ++-- dfvfs/vfs/os_file_entry.py | 16 +++++----- dfvfs/vfs/sqlite_blob_file_entry.py | 6 ++-- dfvfs/vfs/tar_file_entry.py | 12 ++++---- dfvfs/vfs/tsk_file_entry.py | 16 +++++----- dfvfs/vfs/tsk_partition_file_entry.py | 6 ++-- dfvfs/vfs/vshadow_file_entry.py | 6 ++-- dfvfs/vfs/zip_file_entry.py | 6 ++-- 18 files changed, 80 insertions(+), 75 deletions(-) diff --git a/dfvfs/vfs/bde_file_entry.py b/dfvfs/vfs/bde_file_entry.py index 1b544e97..5a886a19 100644 --- a/dfvfs/vfs/bde_file_entry.py +++ b/dfvfs/vfs/bde_file_entry.py @@ -39,7 +39,7 @@ def __init__( resolver_context, file_system, path_spec, is_root=is_root, is_virtual=is_virtual) self._bde_volume = bde_volume - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetStat(self): """Retrieves information about the file entry. diff --git a/dfvfs/vfs/compressed_stream_file_entry.py b/dfvfs/vfs/compressed_stream_file_entry.py index 3d8518ba..d7de0752 100644 --- a/dfvfs/vfs/compressed_stream_file_entry.py +++ b/dfvfs/vfs/compressed_stream_file_entry.py @@ -42,7 +42,7 @@ def __init__( resolver_context, file_system, path_spec, is_root=is_root, is_virtual=is_virtual) self._compressed_stream = compressed_stream - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def __del__(self): """Cleans up the file entry.""" @@ -64,6 +64,6 @@ def _GetStat(self): if self._compressed_stream: stat_object.size = self._compressed_stream.get_size() - stat_object.type = self._type + stat_object.type = self.type return stat_object diff --git a/dfvfs/vfs/cpio_file_entry.py b/dfvfs/vfs/cpio_file_entry.py index 9a29cf81..68c3180c 100644 --- a/dfvfs/vfs/cpio_file_entry.py +++ b/dfvfs/vfs/cpio_file_entry.py @@ -93,18 +93,18 @@ def __init__( # for LINK first. mode = getattr(cpio_archive_file_entry, 'mode', 0) if stat.S_ISLNK(mode): - self._type = definitions.FILE_ENTRY_TYPE_LINK + self.type = definitions.FILE_ENTRY_TYPE_LINK # The root file entry is virtual and should have type directory. elif is_virtual or stat.S_ISDIR(mode): - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY elif stat.S_ISREG(mode): - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE elif stat.S_ISCHR(mode) or stat.S_ISBLK(mode): - self._type = definitions.FILE_ENTRY_TYPE_DEVICE + self.type = definitions.FILE_ENTRY_TYPE_DEVICE elif stat.S_ISFIFO(mode): - self._type = definitions.FILE_ENTRY_TYPE_PIPE + self.type = definitions.FILE_ENTRY_TYPE_PIPE elif stat.S_ISSOCK(mode): - self._type = definitions.FILE_ENTRY_TYPE_SOCKET + self.type = definitions.FILE_ENTRY_TYPE_SOCKET def _GetDirectory(self): """Retrieves a directory. @@ -112,7 +112,7 @@ def _GetDirectory(self): Returns: CPIODirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return CPIODirectory(self._file_system, self.path_spec) def _GetLink(self): @@ -124,7 +124,7 @@ def _GetLink(self): if self._link is None: self._link = '' - if self._type != definitions.FILE_ENTRY_TYPE_LINK: + if self.type != definitions.FILE_ENTRY_TYPE_LINK: return self._link cpio_archive_file = self._file_system.GetCPIOArchiveFile() diff --git a/dfvfs/vfs/encoded_stream_file_entry.py b/dfvfs/vfs/encoded_stream_file_entry.py index d8816e81..672926ab 100644 --- a/dfvfs/vfs/encoded_stream_file_entry.py +++ b/dfvfs/vfs/encoded_stream_file_entry.py @@ -42,7 +42,7 @@ def __init__( resolver_context, file_system, path_spec, is_root=is_root, is_virtual=is_virtual) self._encoded_stream = encoded_stream - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def __del__(self): """Cleans up the file entry.""" @@ -64,6 +64,6 @@ def _GetStat(self): if self._encoded_stream: stat_object.size = self._encoded_stream.get_size() - stat_object.type = self._type + stat_object.type = self.type return stat_object diff --git a/dfvfs/vfs/encrypted_stream_file_entry.py b/dfvfs/vfs/encrypted_stream_file_entry.py index daf26e61..3bf0a348 100644 --- a/dfvfs/vfs/encrypted_stream_file_entry.py +++ b/dfvfs/vfs/encrypted_stream_file_entry.py @@ -42,7 +42,7 @@ def __init__( resolver_context, file_system, path_spec, is_root=is_root, is_virtual=is_virtual) self._encrypted_stream = encrypted_stream - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def __del__(self): """Cleans up the file entry.""" @@ -64,6 +64,6 @@ def _GetStat(self): if self._encrypted_stream: stat_object.size = self._encrypted_stream.get_size() - stat_object.type = self._type + stat_object.type = self.type return stat_object diff --git a/dfvfs/vfs/fake_file_entry.py b/dfvfs/vfs/fake_file_entry.py index 90437c47..79efcc9b 100644 --- a/dfvfs/vfs/fake_file_entry.py +++ b/dfvfs/vfs/fake_file_entry.py @@ -68,7 +68,7 @@ def __init__( is_virtual=True) self._date_time = dfdatetime_fake_time.FakeTime() self._name = None - self._type = file_entry_type + self.type = file_entry_type def _GetDirectory(self): """Retrieves a directory. @@ -76,7 +76,7 @@ def _GetDirectory(self): Returns: FakeDirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return FakeDirectory(self._file_system, self.path_spec) def _GetStat(self): diff --git a/dfvfs/vfs/file_entry.py b/dfvfs/vfs/file_entry.py index 03057808..64fd3f4c 100644 --- a/dfvfs/vfs/file_entry.py +++ b/dfvfs/vfs/file_entry.py @@ -85,7 +85,12 @@ def entries(self): class FileEntry(object): - """VFS file entry interface.""" + """VFS file entry interface. + + Attributes: + path_spec (PathSpec): path specification. + type (int): file entry type or None if not available. + """ def __init__( self, resolver_context, file_system, path_spec, is_root=False, @@ -111,8 +116,8 @@ def __init__( self._link = None self._resolver_context = resolver_context self._stat_object = None - self._type = None self.path_spec = path_spec + self.type = None self._file_system.Open(path_spec) @@ -214,8 +219,8 @@ def _GetStat(self): stat_object.mtime_nano = stat_time_nano # File entry type stat information. - if self._type: - stat_object.type = self._type + if self.type: + stat_object.type = self.type return stat_object @@ -449,8 +454,8 @@ def IsDevice(self): if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: - self._type = self._stat_object.type - return self._type == definitions.FILE_ENTRY_TYPE_DEVICE + self.type = self._stat_object.type + return self.type == definitions.FILE_ENTRY_TYPE_DEVICE def IsDirectory(self): """Determines if the file entry is a directory. @@ -461,8 +466,8 @@ def IsDirectory(self): if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: - self._type = self._stat_object.type - return self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = self._stat_object.type + return self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY def IsFile(self): """Determines if the file entry is a file. @@ -473,8 +478,8 @@ def IsFile(self): if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: - self._type = self._stat_object.type - return self._type == definitions.FILE_ENTRY_TYPE_FILE + self.type = self._stat_object.type + return self.type == definitions.FILE_ENTRY_TYPE_FILE def IsLink(self): """Determines if the file entry is a link. @@ -485,8 +490,8 @@ def IsLink(self): if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: - self._type = self._stat_object.type - return self._type == definitions.FILE_ENTRY_TYPE_LINK + self.type = self._stat_object.type + return self.type == definitions.FILE_ENTRY_TYPE_LINK def IsPipe(self): """Determines if the file entry is a pipe. @@ -497,8 +502,8 @@ def IsPipe(self): if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: - self._type = self._stat_object.type - return self._type == definitions.FILE_ENTRY_TYPE_PIPE + self.type = self._stat_object.type + return self.type == definitions.FILE_ENTRY_TYPE_PIPE def IsRoot(self): """Determines if the file entry is the root file entry. @@ -517,8 +522,8 @@ def IsSocket(self): if self._stat_object is None: self._stat_object = self._GetStat() if self._stat_object is not None: - self._type = self._stat_object.type - return self._type == definitions.FILE_ENTRY_TYPE_SOCKET + self.type = self._stat_object.type + return self.type == definitions.FILE_ENTRY_TYPE_SOCKET def IsVirtual(self): """Determines if the file entry is virtual (emulated by dfVFS). diff --git a/dfvfs/vfs/fvde_file_entry.py b/dfvfs/vfs/fvde_file_entry.py index b1cfb9ca..69d1b9e3 100644 --- a/dfvfs/vfs/fvde_file_entry.py +++ b/dfvfs/vfs/fvde_file_entry.py @@ -38,7 +38,7 @@ def __init__( resolver_context, file_system, path_spec, is_root=is_root, is_virtual=is_virtual) self._fvde_volume = fvde_volume - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetStat(self): """Retrieves information about the file entry. diff --git a/dfvfs/vfs/gzip_file_entry.py b/dfvfs/vfs/gzip_file_entry.py index 27d8ce46..78920a45 100644 --- a/dfvfs/vfs/gzip_file_entry.py +++ b/dfvfs/vfs/gzip_file_entry.py @@ -41,7 +41,7 @@ def __init__( resolver_context, file_system, path_spec, is_root=is_root, is_virtual=is_virtual) self._gzip_file = gzip_file - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def __del__(self): """Cleans up the file entry.""" diff --git a/dfvfs/vfs/lvm_file_entry.py b/dfvfs/vfs/lvm_file_entry.py index d7dcc0fd..7eafc865 100644 --- a/dfvfs/vfs/lvm_file_entry.py +++ b/dfvfs/vfs/lvm_file_entry.py @@ -73,9 +73,9 @@ def __init__( self._vslvm_logical_volume = vslvm_logical_volume if self._is_virtual: - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY else: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetDirectory(self): """Retrieves the directory. @@ -83,7 +83,7 @@ def _GetDirectory(self): Returns: LVMDirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return LVMDirectory(self._file_system, self.path_spec) def _GetStat(self): diff --git a/dfvfs/vfs/ntfs_file_entry.py b/dfvfs/vfs/ntfs_file_entry.py index 21ffd243..d7651292 100644 --- a/dfvfs/vfs/ntfs_file_entry.py +++ b/dfvfs/vfs/ntfs_file_entry.py @@ -275,11 +275,11 @@ def __init__( self._fsntfs_file_entry = fsntfs_file_entry if self._IsLink(fsntfs_file_entry.file_attribute_flags): - self._type = definitions.FILE_ENTRY_TYPE_LINK + self.type = definitions.FILE_ENTRY_TYPE_LINK elif fsntfs_file_entry.has_directory_entries_index(): - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY else: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetAttributes(self): """Retrieves the attributes. diff --git a/dfvfs/vfs/os_file_entry.py b/dfvfs/vfs/os_file_entry.py index 1516dd37..a127da3d 100644 --- a/dfvfs/vfs/os_file_entry.py +++ b/dfvfs/vfs/os_file_entry.py @@ -116,7 +116,7 @@ def __init__(self, resolver_context, file_system, path_spec, is_root=False): self._stat_info = stat_info if is_windows_device: - self._type = definitions.FILE_ENTRY_TYPE_DEVICE + self.type = definitions.FILE_ENTRY_TYPE_DEVICE elif stat_info: # If location contains a trailing segment separator and points to @@ -130,18 +130,18 @@ def __init__(self, resolver_context, file_system, path_spec, is_root=False): # dfVFS currently only supports one type so we need to check # for LINK first. if stat.S_ISLNK(stat_info.st_mode) or is_link: - self._type = definitions.FILE_ENTRY_TYPE_LINK + self.type = definitions.FILE_ENTRY_TYPE_LINK elif stat.S_ISREG(stat_info.st_mode): - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE elif stat.S_ISDIR(stat_info.st_mode): - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY elif (stat.S_ISCHR(stat_info.st_mode) or stat.S_ISBLK(stat_info.st_mode)): - self._type = definitions.FILE_ENTRY_TYPE_DEVICE + self.type = definitions.FILE_ENTRY_TYPE_DEVICE elif stat.S_ISFIFO(stat_info.st_mode): - self._type = definitions.FILE_ENTRY_TYPE_PIPE + self.type = definitions.FILE_ENTRY_TYPE_PIPE elif stat.S_ISSOCK(stat_info.st_mode): - self._type = definitions.FILE_ENTRY_TYPE_SOCKET + self.type = definitions.FILE_ENTRY_TYPE_SOCKET def _GetDirectory(self): """Retrieves a directory. @@ -149,7 +149,7 @@ def _GetDirectory(self): Returns: OSDirectory: a directory object or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return OSDirectory(self._file_system, self.path_spec) def _GetLink(self): diff --git a/dfvfs/vfs/sqlite_blob_file_entry.py b/dfvfs/vfs/sqlite_blob_file_entry.py index 22da967a..45251ace 100644 --- a/dfvfs/vfs/sqlite_blob_file_entry.py +++ b/dfvfs/vfs/sqlite_blob_file_entry.py @@ -89,9 +89,9 @@ def __init__( self._number_of_entries = None if is_virtual: - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY else: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetDirectory(self): """Retrieves a directory. @@ -99,7 +99,7 @@ def _GetDirectory(self): Returns: SQLiteBlobDirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return SQLiteBlobDirectory(self._file_system, self.path_spec) def _GetStat(self): diff --git a/dfvfs/vfs/tar_file_entry.py b/dfvfs/vfs/tar_file_entry.py index 82668aa6..7d4bd73e 100644 --- a/dfvfs/vfs/tar_file_entry.py +++ b/dfvfs/vfs/tar_file_entry.py @@ -110,15 +110,15 @@ def __init__( self._tar_info = tar_info if self._is_virtual or self._tar_info.isdir(): - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY elif self._tar_info.isfile(): - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE elif self._tar_info.issym() or self._tar_info.islnk(): - self._type = definitions.FILE_ENTRY_TYPE_LINK + self.type = definitions.FILE_ENTRY_TYPE_LINK elif self._tar_info.ischr() or self._tar_info.isblk(): - self._type = definitions.FILE_ENTRY_TYPE_DEVICE + self.type = definitions.FILE_ENTRY_TYPE_DEVICE elif self._tar_info.isfifo(): - self._type = definitions.FILE_ENTRY_TYPE_PIPE + self.type = definitions.FILE_ENTRY_TYPE_PIPE def _GetDirectory(self): """Retrieves a directory. @@ -126,7 +126,7 @@ def _GetDirectory(self): Returns: TARDirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return TARDirectory(self._file_system, self.path_spec) def _GetLink(self): diff --git a/dfvfs/vfs/tsk_file_entry.py b/dfvfs/vfs/tsk_file_entry.py index ff6b9d68..ff694eb2 100644 --- a/dfvfs/vfs/tsk_file_entry.py +++ b/dfvfs/vfs/tsk_file_entry.py @@ -383,18 +383,18 @@ def __init__( tsk_file.info.meta, 'type', pytsk3.TSK_FS_META_TYPE_UNDEF) if tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_REG: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE elif tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_DIR: - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY elif tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_LNK: - self._type = definitions.FILE_ENTRY_TYPE_LINK + self.type = definitions.FILE_ENTRY_TYPE_LINK elif (tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_CHR or tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_BLK): - self._type = definitions.FILE_ENTRY_TYPE_DEVICE + self.type = definitions.FILE_ENTRY_TYPE_DEVICE elif tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_FIFO: - self._type = definitions.FILE_ENTRY_TYPE_PIPE + self.type = definitions.FILE_ENTRY_TYPE_PIPE elif tsk_fs_meta_type == pytsk3.TSK_FS_META_TYPE_SOCK: - self._type = definitions.FILE_ENTRY_TYPE_SOCKET + self.type = definitions.FILE_ENTRY_TYPE_SOCKET # TODO: implement support for: # pytsk3.TSK_FS_META_TYPE_UNDEF @@ -473,7 +473,7 @@ def _GetDirectory(self): Returns: TSKDirectory: directory or None. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return TSKDirectory(self._file_system, self.path_spec) def _GetLink(self): @@ -485,7 +485,7 @@ def _GetLink(self): if self._link is None: self._link = '' - if self._type != definitions.FILE_ENTRY_TYPE_LINK: + if self.type != definitions.FILE_ENTRY_TYPE_LINK: return self._link # Note that the SleuthKit does not expose NTFS diff --git a/dfvfs/vfs/tsk_partition_file_entry.py b/dfvfs/vfs/tsk_partition_file_entry.py index 95b9064b..412ebced 100644 --- a/dfvfs/vfs/tsk_partition_file_entry.py +++ b/dfvfs/vfs/tsk_partition_file_entry.py @@ -101,9 +101,9 @@ def __init__( self._tsk_vs_part = tsk_vs_part if is_virtual: - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY else: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetDirectory(self): """Retrieves a directory. @@ -111,7 +111,7 @@ def _GetDirectory(self): Returns: TSKPartitionDirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return TSKPartitionDirectory(self._file_system, self.path_spec) def _GetStat(self): diff --git a/dfvfs/vfs/vshadow_file_entry.py b/dfvfs/vfs/vshadow_file_entry.py index 0b976508..956c0c9e 100644 --- a/dfvfs/vfs/vshadow_file_entry.py +++ b/dfvfs/vfs/vshadow_file_entry.py @@ -76,9 +76,9 @@ def __init__( self._vshadow_store = vshadow_store if self._is_virtual: - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY else: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetDirectory(self): """Retrieves a directory. @@ -86,7 +86,7 @@ def _GetDirectory(self): Returns: VShadowDirectory: a directory None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return VShadowDirectory(self._file_system, self.path_spec) def _GetStat(self): diff --git a/dfvfs/vfs/zip_file_entry.py b/dfvfs/vfs/zip_file_entry.py index 14b1d30d..63d849d7 100644 --- a/dfvfs/vfs/zip_file_entry.py +++ b/dfvfs/vfs/zip_file_entry.py @@ -126,9 +126,9 @@ def __init__( if (is_virtual or self._external_attributes & self._MSDOS_FILE_ATTRIBUTES_IS_DIRECTORY): - self._type = definitions.FILE_ENTRY_TYPE_DIRECTORY + self.type = definitions.FILE_ENTRY_TYPE_DIRECTORY else: - self._type = definitions.FILE_ENTRY_TYPE_FILE + self.type = definitions.FILE_ENTRY_TYPE_FILE def _GetDirectory(self): """Retrieves a directory. @@ -136,7 +136,7 @@ def _GetDirectory(self): Returns: ZipDirectory: a directory or None if not available. """ - if self._type == definitions.FILE_ENTRY_TYPE_DIRECTORY: + if self.type == definitions.FILE_ENTRY_TYPE_DIRECTORY: return ZipDirectory(self._file_system, self.path_spec) def _GetStat(self):