File tree Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Expand file tree Collapse file tree 2 files changed +22
-7
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ export function setShowError(value: boolean);
14
14
15
15
export interface ZippedAssetPackageOptions {
16
16
zipPath : string ;
17
+ basePack ?
17
18
}
18
19
19
20
export class ZippedAssetPackage extends BaseNative < any , ZippedAssetPackageOptions > {
Original file line number Diff line number Diff line change @@ -67,13 +67,27 @@ const currentAppFolder = knownFolders.currentApp();
67
67
68
68
export class ZippedAssetPackage extends BaseNative < NTZippedAssetPackage , ZippedAssetPackageOptions > {
69
69
createNative ( options : ZippedAssetPackageOptions ) {
70
- const zipPath = getRelativePathToApp ( options . zipPath ) ;
71
- if ( File . exists ( zipPath ) ) {
72
- const vectorTileStyleSetData = NTAssetUtils . loadAsset ( zipPath ) ;
73
- return NTZippedAssetPackage . alloc ( ) . initWithZipData ( vectorTileStyleSetData ) ;
74
- } else {
75
- console . error ( `could not find zip file: ${ options . zipPath } ` ) ;
76
- return null ;
70
+ let zipPath ;
71
+ try {
72
+ const fullZipPath = getFileName ( options . zipPath ) ;
73
+ zipPath = getRelativePathToApp ( options . zipPath ) ;
74
+ if ( File . exists ( fullZipPath ) ) {
75
+ let assetPackage : NTAssetPackage ;
76
+ if ( options . basePack ) {
77
+ assetPackage = options . basePack . getNative ( ) ;
78
+ }
79
+ const vectorTileStyleSetData = NTAssetUtils . loadAsset ( zipPath ) ;
80
+ if ( assetPackage ) {
81
+ return NTZippedAssetPackage . alloc ( ) . initWithZipDataBaseAssetPackage ( vectorTileStyleSetData , assetPackage ) ;
82
+ } else {
83
+ return NTZippedAssetPackage . alloc ( ) . initWithZipData ( vectorTileStyleSetData ) ;
84
+ }
85
+ } else {
86
+ throw new Error ( `could not find zip file: ${ options . zipPath } (${ zipPath } )` )
87
+ }
88
+ } catch ( error ) {
89
+ console . error ( `ZippedAssetPackage(${ zipPath } , ${ options . zipPath } ): ${ error } ` ) ;
90
+ throw error ;
77
91
}
78
92
}
79
93
getAssetNames ( ) {
You can’t perform that action at this time.
0 commit comments