getImagickStaticPath
This commit is contained in:
parent
750bd46315
commit
7a59818e58
|
@ -8,7 +8,7 @@ import { getSkipAppVersion, setSkipAppVersion } from './userPreference';
|
|||
import fetch from 'node-fetch';
|
||||
import { logErrorSentry } from './sentry';
|
||||
import ElectronLog from 'electron-log';
|
||||
import { isPlatform } from 'utils/main';
|
||||
import { isPlatform } from '../utils/main';
|
||||
|
||||
const FIVE_MIN_IN_MICROSECOND = 5 * 60 * 1000;
|
||||
|
||||
|
|
|
@ -6,10 +6,17 @@ import { readFile, writeFile } from 'promise-fs';
|
|||
import { generateTempFilePath } from '../utils/temp';
|
||||
import { logErrorSentry } from './sentry';
|
||||
import { isPlatform } from '../utils/main';
|
||||
import pathToImageMagick from '../pkg/image-magick-static';
|
||||
import { isDev } from '../utils/common';
|
||||
import path from 'path';
|
||||
|
||||
const asyncExec = util.promisify(exec);
|
||||
|
||||
function getImageMagickStaticPath() {
|
||||
return isDev
|
||||
? 'build/image-magick'
|
||||
: path.join(process.resourcesPath, 'image-magick');
|
||||
}
|
||||
|
||||
export async function convertHEIC(
|
||||
heicFileData: Uint8Array
|
||||
): Promise<Uint8Array> {
|
||||
|
@ -54,7 +61,7 @@ async function runConvertCommand(
|
|||
);
|
||||
} else if (isPlatform('linux')) {
|
||||
await asyncExec(
|
||||
`${pathToImageMagick} ${tempInputFilePath} -quality 100% ${tempOutputFilePath}`
|
||||
`${getImageMagickStaticPath()} ${tempInputFilePath} -quality 100% ${tempOutputFilePath}`
|
||||
);
|
||||
} else {
|
||||
Error(`${process.platform} native heic convert not supported yet`);
|
||||
|
|
Loading…
Reference in a new issue