Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions dfvfs/vfs/fat_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def FileEntryExistsByPathSpec(self, path_spec):
BackEndError: if the file entry cannot be opened.
"""
# Opening a file by identifier is faster than opening a file by location,
# but can fail in determining the VFAT long file name.
# but does not preserve the VFAT long file name.
fsfat_file_entry = None
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)
Expand Down Expand Up @@ -110,7 +110,7 @@ def GetFileEntryByPathSpec(self, path_spec):
BackEndError: if the file entry cannot be opened.
"""
# Opening a file by identifier is faster than opening a file by location,
# but can fail in determining the VFAT long file name.
# but does not preserve the VFAT long file name.
fsfat_file_entry = None
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)
Expand Down Expand Up @@ -153,7 +153,7 @@ def GetFATFileEntryByPathSpec(self, path_spec):
identifier.
"""
# Opening a file by identifier is faster than opening a file by location,
# but can fail in determining the VFAT long file name.
# but does not preserve the VFAT long file name.
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)

Expand Down
21 changes: 12 additions & 9 deletions dfvfs/vfs/hfs_file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,17 @@ def FileEntryExistsByPathSpec(self, path_spec):
BackEndError: if the file entry cannot be opened.
"""
# Opening a file by identifier is faster than opening a file by location.
# but does not preserve the name of indirect nodes.
fshfs_file_entry = None
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)

try:
if identifier is not None:
if location is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_path(location)
elif identifier is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_identifier(
identifier)
elif location is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_path(location)

except IOError as exception:
raise errors.BackEndError(exception)
Expand All @@ -105,6 +106,7 @@ def GetFileEntryByPathSpec(self, path_spec):
BackEndError: if the file entry cannot be opened.
"""
# Opening a file by identifier is faster than opening a file by location.
# but does not preserve the name of indirect nodes.
fshfs_file_entry = None
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)
Expand All @@ -117,11 +119,11 @@ def GetFileEntryByPathSpec(self, path_spec):
fshfs_file_entry=fshfs_file_entry, is_root=True)

try:
if identifier is not None:
if location is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_path(location)
elif identifier is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_identifier(
identifier)
elif location is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_path(location)

except IOError as exception:
raise errors.BackEndError(exception)
Expand All @@ -147,14 +149,15 @@ def GetHFSFileEntryByPathSpec(self, path_spec):
identifier.
"""
# Opening a file by identifier is faster than opening a file by location.
# but does not preserve the name of indirect nodes.
location = getattr(path_spec, 'location', None)
identifier = getattr(path_spec, 'identifier', None)

if identifier is not None:
if location is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_path(location)
elif identifier is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_identifier(
identifier)
elif location is not None:
fshfs_file_entry = self._fshfs_volume.get_file_entry_by_path(location)
else:
raise errors.PathSpecError(
'Path specification missing location and identifier.')
Expand Down
Loading