Update electron to 17.3.0
This commit is contained in:
parent
8b36e37d18
commit
f7c3a44056
6 changed files with 15 additions and 87 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
import { join } from 'path';
|
||||
import { Worker } from 'worker_threads';
|
||||
import { app } from 'electron';
|
||||
|
||||
export type WrappedWorkerRequest = {
|
||||
readonly uuid: string;
|
||||
|
@ -15,25 +16,17 @@ export type WrappedWorkerResponse = {
|
|||
readonly response?: File;
|
||||
};
|
||||
|
||||
const ASAR_PATTERN = /app\.asar$/;
|
||||
|
||||
export function getHeicConverter(): (
|
||||
uuid: string,
|
||||
data: Uint8Array
|
||||
) => Promise<WrappedWorkerResponse> {
|
||||
let appDir = join(__dirname, '..', '..');
|
||||
let isBundled = false;
|
||||
if (ASAR_PATTERN.test(appDir)) {
|
||||
appDir = appDir.replace(ASAR_PATTERN, 'app.asar.unpacked');
|
||||
isBundled = true;
|
||||
}
|
||||
const scriptDir = join(appDir, 'ts', 'workers');
|
||||
const worker = new Worker(
|
||||
join(
|
||||
scriptDir,
|
||||
isBundled ? 'heicConverter.bundle.js' : 'heicConverterWorker.js'
|
||||
)
|
||||
const scriptDir = join(
|
||||
app.getAppPath(),
|
||||
'ts',
|
||||
'workers',
|
||||
'heicConverterWorker.js'
|
||||
);
|
||||
const worker = new Worker(scriptDir);
|
||||
|
||||
const ResponseMap = new Map<
|
||||
string,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue