Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

rename ggmlclip to ggmlclip-mac

Abhinav954b080bacba
diff --git a/build/ggmlclip b/build/ggmlclip-mac
similarity index 100%
rename from build/ggmlclip
rename to build/ggmlclip-mac
diff --git a/src/services/clipService.ts b/src/services/clipService.ts
index ed0059a305..df8d4d0721 100644
--- a/src/services/clipService.ts
+++ b/src/services/clipService.ts
@@ -10,6 +10,7 @@ const shellescape = require('any-shell-escape');
const execAsync = util.promisify(require('child_process').exec);
import fetch from 'node-fetch';
import { writeNodeStream } from './fs';
+import { getPlatform } from '../utils/common/platform';
const CLIP_MODEL_PATH_PLACEHOLDER = 'CLIP_MODEL';
const GGMLCLIP_PATH_PLACEHOLDER = 'GGML_PATH';
@@ -78,7 +79,9 @@ export async function getClipModelPath() {
}
function getGGMLClipPath() {
- return './bin/ggmlclip';
+ return isDev
+ ? path.join('./build', `ggmlclip-${getPlatform()}`)
+ : path.join(process.resourcesPath, `ggmlclip-${getPlatform()}`);
}
export async function computeImageEmbedding(
diff --git a/src/utils/common/platform.ts b/src/utils/common/platform.ts
index 2ee705d5f9..0326ba0adb 100644
--- a/src/utils/common/platform.ts
+++ b/src/utils/common/platform.ts
@@ -1,11 +1,19 @@
export function isPlatform(platform: 'mac' | 'windows' | 'linux') {
- if (process.platform === 'darwin') {
- return platform === 'mac';
- } else if (process.platform === 'win32') {
- return platform === 'windows';
- } else if (process.platform === 'linux') {
- return platform === 'linux';
- } else {
- return false;
+ return getPlatform() === platform;
+}
+
+export function getPlatform(): 'mac' | 'windows' | 'linux' {
+ switch (process.platform) {
+ case 'aix':
+ case 'freebsd':
+ case 'linux':
+ case 'openbsd':
+ case 'android':
+ return 'linux';
+ case 'darwin':
+ case 'sunos':
+ return 'mac';
+ case 'win32':
+ return 'windows';
}
}