Skip to content

Commit 640b663

Browse files
committed
fix(ios): resource loading fix
1 parent ba2b299 commit 640b663

File tree

1 file changed

+19
-13
lines changed

1 file changed

+19
-13
lines changed

src/ui-carto/utils/index.ios.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,27 @@ const currentAppFolder = knownFolders.currentApp();
7373

7474
export class ZippedAssetPackage extends BaseNative<NTZippedAssetPackage, ZippedAssetPackageOptions> {
7575
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+
}
8591
} else {
86-
return NTZippedAssetPackage.alloc().initWithZipData(vectorTileStyleSetData);
92+
throw new Error(`could not find zip file: ${options.zipPath}(${zipPath})`)
8793
}
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;
9197
}
9298
}
9399
getAssetNames() {

0 commit comments

Comments
 (0)