support for checking out non-blend files
This commit is contained in:
@@ -322,6 +322,7 @@ class FileAPI(Resource):
|
|||||||
paths_remap = {}
|
paths_remap = {}
|
||||||
paths_uuid = {}
|
paths_uuid = {}
|
||||||
|
|
||||||
|
if filepath.endswith(".blend"):
|
||||||
try:
|
try:
|
||||||
yield from blendfile_pack.pack(
|
yield from blendfile_pack.pack(
|
||||||
filepath.encode('utf-8'), filepath_zip.encode('utf-8'), mode='ZIP',
|
filepath.encode('utf-8'), filepath_zip.encode('utf-8'), mode='ZIP',
|
||||||
@@ -333,6 +334,19 @@ class FileAPI(Resource):
|
|||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return
|
return
|
||||||
|
else:
|
||||||
|
# non blend-file
|
||||||
|
from bam_utils.system import sha1_from_file
|
||||||
|
paths_uuid[os.path.basename(filepath)] = sha1_from_file(filepath)
|
||||||
|
del sha1_from_file
|
||||||
|
|
||||||
|
import zipfile
|
||||||
|
with zipfile.ZipFile(filepath_zip, 'w', zipfile.ZIP_DEFLATED) as zip_handle:
|
||||||
|
zip_handle.write(
|
||||||
|
filepath,
|
||||||
|
arcname=os.path.basename(filepath),
|
||||||
|
)
|
||||||
|
del zipfile
|
||||||
|
|
||||||
# TODO, avoid reopening zipfile
|
# TODO, avoid reopening zipfile
|
||||||
# append json info to zip
|
# append json info to zip
|
||||||
|
Reference in New Issue
Block a user