Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Fix asset unpacking

Hakan Shehu78f2ee1cf32f
diff --git a/apps/desktop/src/main/services/asset-service.ts b/apps/desktop/src/main/services/asset-service.ts
index 57a8ac0a..ef2ab630 100644
--- a/apps/desktop/src/main/services/asset-service.ts
+++ b/apps/desktop/src/main/services/asset-service.ts
@@ -64,7 +64,7 @@ class AssetService {
}
private async updateEmojis(): Promise<void> {
- const emojisZipPath = path.join(__dirname, 'assets', 'emojis.zip');
+ const emojisZipPath = path.join(this.getAssetsSourcePath(), 'emojis.zip');
const emojisDir = path.join(this.assetsDir, 'emojis');
if (fs.existsSync(emojisDir)) {
fs.rmSync(emojisDir, { recursive: true });
@@ -78,7 +78,7 @@ class AssetService {
}
private async updateIcons(): Promise<void> {
- const iconsZipPath = path.join(__dirname, 'assets', 'icons.zip');
+ const iconsZipPath = path.join(this.getAssetsSourcePath(), 'icons.zip');
const iconsDir = path.join(this.assetsDir, 'icons');
if (fs.existsSync(iconsDir)) {
fs.rmSync(iconsDir, { recursive: true });
@@ -123,6 +123,14 @@ class AssetService {
})
);
}
+
+ private getAssetsSourcePath(): string {
+ if (app.isPackaged) {
+ return path.join(process.resourcesPath, 'assets');
+ }
+
+ return path.resolve(__dirname, '../../assets');
+ }
}
export const assetService = new AssetService();