update: directory structure for binary files
This commit is contained in:
parent
95fa5b4ac7
commit
496c00e7e3
@ -1,6 +1,5 @@
|
||||
import gulp from "gulp";
|
||||
import ts from "gulp-typescript";
|
||||
// @ts-ignore
|
||||
import clean from "gulp-clean";
|
||||
import fs from "fs";
|
||||
|
||||
@ -30,7 +29,7 @@ gulp.task("assets", () => {
|
||||
});
|
||||
|
||||
gulp.task("binary", () => {
|
||||
return gulp.src("bin/**/*", { encoding: false }).pipe(gulp.dest("dist/electron/bin"));
|
||||
return gulp.src(`bin/${process.platform}-${process.arch}/**/*`, { encoding: false }).pipe(gulp.dest("dist/electron/bin"));
|
||||
});
|
||||
|
||||
gulp.task("locales", () => {
|
||||
|
@ -2,17 +2,17 @@ import * as path from "path";
|
||||
import { Database } from "better-sqlite3";
|
||||
import DB from "better-sqlite3";
|
||||
import { __dirname } from "../dirname.js";
|
||||
import { getDatabaseDir } from "../utils/index.js";
|
||||
import { getBinDir, getDatabaseDir } from "../utils/index.js";
|
||||
import { migrate } from "./migrate/index.js";
|
||||
|
||||
function getLibSimpleExtensionPath() {
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
return path.join(__dirname, "bin", process.platform, "libsimple", "simple.dll");
|
||||
return path.join(getBinDir(), "libsimple", "simple.dll");
|
||||
case "darwin":
|
||||
return path.join(__dirname, "bin", process.platform, "libsimple", "libsimple.dylib");
|
||||
return path.join(getBinDir(), "libsimple", "libsimple.dylib");
|
||||
case "linux":
|
||||
return path.join(__dirname, "bin", process.platform, "libsimple", "libsimple.so");
|
||||
return path.join(getBinDir(), "libsimple", "libsimple.so");
|
||||
default:
|
||||
throw new Error("Unsupported platform");
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import { getUserDataDir } from "../platform/index.js";
|
||||
import { __dirname } from "../../dirname.js";
|
||||
|
||||
export function createDataDir() {
|
||||
const dataDir = getUserDataDir();
|
||||
@ -68,6 +69,10 @@ export function getLogDir() {
|
||||
return logDir;
|
||||
}
|
||||
|
||||
export function getBinDir() {
|
||||
return path.join(__dirname, "bin");
|
||||
}
|
||||
|
||||
export async function waitForFileExists(filePath: string, timeout: number = 10000): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
fs.access(filePath, fs.constants.F_OK, (err) => {
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { join } from "path";
|
||||
import os from "os";
|
||||
import { app } from "electron";
|
||||
import { __dirname } from "../../dirname.js";
|
||||
import { logger } from "../index.js";
|
||||
import { getBinDir, logger } from "../index.js";
|
||||
|
||||
export function getUserDataDir() {
|
||||
switch (process.platform) {
|
||||
@ -41,13 +40,13 @@ export function getFFmpegPath() {
|
||||
let path = "";
|
||||
switch (process.platform) {
|
||||
case "win32":
|
||||
path = join(__dirname, "bin", process.platform, "ffmpeg.exe");
|
||||
path = join(getBinDir(), "ffmpeg.exe");
|
||||
break;
|
||||
case "darwin":
|
||||
path = join(__dirname, "bin", process.platform, "ffmpeg");
|
||||
path = join(getBinDir(), "ffmpeg");
|
||||
break;
|
||||
case "linux":
|
||||
path = join(__dirname, "bin", process.platform, "ffmpeg");
|
||||
path = join(getBinDir(), "ffmpeg");
|
||||
break;
|
||||
default:
|
||||
throw new Error("Unsupported platform");
|
||||
@ -55,3 +54,7 @@ export function getFFmpegPath() {
|
||||
logger.info("FFmpeg path: %s", path);
|
||||
return path;
|
||||
}
|
||||
|
||||
export function getOCRitPath() {
|
||||
const path = join(getBinDir(), "ocrit");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user