OLD | NEW |
1 # -*- coding: utf-8 -*- | 1 # -*- coding: utf-8 -*- |
2 """The FVDE file entry implementation.""" | 2 """The FVDE file entry implementation.""" |
3 | 3 |
| 4 from __future__ import unicode_literals |
| 5 |
4 from dfvfs.lib import definitions | 6 from dfvfs.lib import definitions |
5 from dfvfs.lib import errors | 7 from dfvfs.lib import errors |
6 from dfvfs.vfs import root_only_file_entry | 8 from dfvfs.vfs import root_only_file_entry |
7 from dfvfs.vfs import vfs_stat | 9 from dfvfs.vfs import vfs_stat |
8 | 10 |
9 | 11 |
10 class FVDEFileEntry(root_only_file_entry.RootOnlyFileEntry): | 12 class FVDEFileEntry(root_only_file_entry.RootOnlyFileEntry): |
11 """Class that implements a file entry object using FVDE.""" | 13 """Class that implements a file entry object using FVDE.""" |
12 | 14 |
13 TYPE_INDICATOR = definitions.TYPE_INDICATOR_FVDE | 15 TYPE_INDICATOR = definitions.TYPE_INDICATOR_FVDE |
14 | 16 |
15 def _GetStat(self): | 17 def _GetStat(self): |
16 """Retrieves the stat object. | 18 """Retrieves the stat object. |
17 | 19 |
18 Returns: | 20 Returns: |
19 VFSStat: stat object. | 21 VFSStat: stat object. |
20 | 22 |
21 Raises: | 23 Raises: |
22 BackEndError: when the FVDE file is missing. | 24 BackEndError: when the FVDE file is missing. |
23 """ | 25 """ |
24 fvde_volume = self._file_system.GetFVDEVolume() | 26 fvde_volume = self._file_system.GetFVDEVolume() |
25 if fvde_volume is None: | 27 if fvde_volume is None: |
26 raise errors.BackEndError(u'Missing FVDE volume.') | 28 raise errors.BackEndError('Missing FVDE volume.') |
27 | 29 |
28 stat_object = vfs_stat.VFSStat() | 30 stat_object = vfs_stat.VFSStat() |
29 | 31 |
30 # File data stat information. | 32 # File data stat information. |
31 stat_object.size = fvde_volume.get_size() | 33 stat_object.size = fvde_volume.get_size() |
32 | 34 |
33 # Date and time stat information. | 35 # Date and time stat information. |
34 | 36 |
35 # Ownership and permissions stat information. | 37 # Ownership and permissions stat information. |
36 | 38 |
37 # File entry type stat information. | 39 # File entry type stat information. |
38 stat_object.type = stat_object.TYPE_FILE | 40 stat_object.type = stat_object.TYPE_FILE |
39 | 41 |
40 # Other stat information. | 42 # Other stat information. |
41 | 43 |
42 return stat_object | 44 return stat_object |
OLD | NEW |