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