mirror of
https://github.com/elliotnunn/machfs.git
synced 2024-12-28 08:30:34 +00:00
setter for vol name
This commit is contained in:
parent
854e8b987c
commit
12cca25a70
@ -53,6 +53,10 @@ class AbstractFolder(collections.MutableMapping):
|
|||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self._maindict)
|
return len(self._maindict)
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
the_dict = {self._prefdict[k]: v for (k, v) in self._maindict.items()}
|
||||||
|
return repr(the_dict)
|
||||||
|
|
||||||
def iter_paths(self):
|
def iter_paths(self):
|
||||||
for name, child in self.items():
|
for name, child in self.items():
|
||||||
print(name, child)
|
print(name, child)
|
||||||
|
11
main.py
11
main.py
@ -103,7 +103,16 @@ class Volume(_directory.AbstractFolder):
|
|||||||
self.bootblocks = bytes(1024) # optional; for booting HFS volumes
|
self.bootblocks = bytes(1024) # optional; for booting HFS volumes
|
||||||
self.crdate = 0 # date and time of volume creation
|
self.crdate = 0 # date and time of volume creation
|
||||||
self.lsmod = 0 # date and time of last modification
|
self.lsmod = 0 # date and time of last modification
|
||||||
self.name = b'Untitled'
|
self._name = b'Untitled'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return self._name
|
||||||
|
@name.setter
|
||||||
|
def name(self, value):
|
||||||
|
if len(value) > 27:
|
||||||
|
raise ValueError('Max volume name length = 27')
|
||||||
|
self._name = value
|
||||||
|
|
||||||
def read(self, from_volume):
|
def read(self, from_volume):
|
||||||
self._dirtree = {}
|
self._dirtree = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user