Fixed bug with libreoffice command line wrapper

This commit is contained in:
Saud Fatayerji 2023-11-19 20:08:29 +03:00
parent 7df48d43d6
commit d73a61ae3d

View File

@ -1,7 +1,7 @@
import { readBinaryFile, writeBinaryFile, removeDir, BaseDirectory } from '@tauri-apps/api/fs'; import { readBinaryFile, writeBinaryFile, removeDir, BaseDirectory } from '@tauri-apps/api/fs';
import { PdfFile,RepresentationType } from '@stirling-pdf/shared-operations/src/wrappers/PdfFile' import { PdfFile,RepresentationType } from '@stirling-pdf/shared-operations/src/wrappers/PdfFile'
import { runShell } from './tauri-wrapper'; import { runShell, isTauriAvailable } from './tauri-wrapper';
export async function fileToPdf(byteArray: Uint8Array, filename: string): Promise<PdfFile> { export async function fileToPdf(byteArray: Uint8Array, filename: string): Promise<PdfFile> {
const randUuid = crypto.randomUUID(); const randUuid = crypto.randomUUID();
@ -30,6 +30,8 @@ export async function fileToPdf(byteArray: Uint8Array, filename: string): Promis
} }
export async function isLibreOfficeInstalled() { export async function isLibreOfficeInstalled() {
if (!isTauriAvailable()) return false;
const messageList: string[] = []; const messageList: string[] = [];
try { try {
await runShell("libreoffice-version", ["--version"], (message, stream) => { await runShell("libreoffice-version", ["--version"], (message, stream) => {