@@ -73,21 +73,27 @@ const currentAppFolder = knownFolders.currentApp();
73
73
74
74
export class ZippedAssetPackage extends BaseNative < NTZippedAssetPackage , ZippedAssetPackageOptions > {
75
75
createNative ( options : ZippedAssetPackageOptions ) {
76
- const zipPath = getRelativePathToApp ( options . zipPath ) ;
77
- if ( File . exists ( zipPath ) ) {
78
- let assetPackage : NTAssetPackage ;
79
- if ( options . basePack ) {
80
- assetPackage = options . basePack . getNative ( ) ;
81
- }
82
- const vectorTileStyleSetData = NTAssetUtils . loadAsset ( zipPath ) ;
83
- if ( assetPackage ) {
84
- return NTZippedAssetPackage . alloc ( ) . initWithZipDataBaseAssetPackage ( vectorTileStyleSetData , assetPackage ) ;
76
+ let zipPath ;
77
+ try {
78
+ const fullZipPath = getFileName ( options . zipPath ) ;
79
+ zipPath = getRelativePathToApp ( options . zipPath ) ;
80
+ if ( File . exists ( fullZipPath ) ) {
81
+ let assetPackage : NTAssetPackage ;
82
+ if ( options . basePack ) {
83
+ assetPackage = options . basePack . getNative ( ) ;
84
+ }
85
+ const vectorTileStyleSetData = NTAssetUtils . loadAsset ( zipPath ) ;
86
+ if ( assetPackage ) {
87
+ return NTZippedAssetPackage . alloc ( ) . initWithZipDataBaseAssetPackage ( vectorTileStyleSetData , assetPackage ) ;
88
+ } else {
89
+ return NTZippedAssetPackage . alloc ( ) . initWithZipData ( vectorTileStyleSetData ) ;
90
+ }
85
91
} else {
86
- return NTZippedAssetPackage . alloc ( ) . initWithZipData ( vectorTileStyleSetData ) ;
92
+ throw new Error ( `could not find zip file: ${ options . zipPath } ( ${ zipPath } )` )
87
93
}
88
- } else {
89
- console . error ( `could not find zip file: ${ options . zipPath } ( ${ zipPath } ) ` ) ;
90
- return null ;
94
+ } catch ( error ) {
95
+ console . error ( `ZippedAssetPackage( ${ zipPath } , ${ options . zipPath } ): ${ error } ` ) ;
96
+ throw error ;
91
97
}
92
98
}
93
99
getAssetNames ( ) {
0 commit comments