-
Notifications
You must be signed in to change notification settings - Fork 0
Dumper
James Lott edited this page Mar 10, 2018
·
4 revisions
[[TOC]]
from mkpython.dumper import BaseDumper
from mkpython.dumper import DumperError
class MyDumper(BaseDumper):
def dump(self, pack):
try:
for path in pack.paths():
data = pack.data(path)
self._write_asset(path, data)
except EnvironmentError as e:
raise DumperError(e)
def _write_asset(self, path, data):
full_path = '%s/%s' % (self.location, path)
# Some other business logic to write the data to its destinationThis value represents the base location which the write destination of all other
assets should be relative to. It is populated by __init__().
instance.dump(pack)
This method must be implemented by each dumper class. Its job is to determine the write
destination for each asset in the AssetPack passed in pack and write the asset data
to that destination. If any asset fails to write for any reason, this method is expected
to raise a DumperError.