File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -714,7 +714,7 @@ class ObfProcessor extends BaseProcessor {
714714 }
715715
716716 async saveFromTree ( tree : AACTree , outputPath : string ) : Promise < void > {
717- const { writeTextToPath, writeBinaryToPath } = this . options . fileAdapter ;
717+ const { writeTextToPath, writeBinaryToPath, pathExists } = this . options . fileAdapter ;
718718 if ( outputPath . endsWith ( '.obf' ) ) {
719719 // Save as single OBF JSON file
720720 const rootPage = tree . rootId ? tree . getPage ( tree . rootId ) : Object . values ( tree . pages ) [ 0 ] ;
@@ -734,8 +734,11 @@ class ObfProcessor extends BaseProcessor {
734734 data : new TextEncoder ( ) . encode ( obfContent ) ,
735735 } ;
736736 } ) ;
737- //TODO update zip to retain images
738- this . zipFile = await this . options . zipAdapter ( undefined , this . options . fileAdapter ) ;
737+ const fileExists = await pathExists ( outputPath ) ;
738+ this . zipFile = await this . options . zipAdapter (
739+ fileExists ? outputPath : undefined ,
740+ this . options . fileAdapter
741+ ) ;
739742 const zipData = await this . zipFile . writeFiles ( files ) ;
740743 await writeBinaryToPath ( outputPath , zipData ) ;
741744 }
You can’t perform that action at this time.
0 commit comments