diff --git a/src/lib/server/fileUtil.ts b/src/lib/server/fileUtil.ts index b8c980f..f4ee4cc 100644 --- a/src/lib/server/fileUtil.ts +++ b/src/lib/server/fileUtil.ts @@ -30,9 +30,9 @@ async function createEmptyJsonFile(path: string) { await storeObject({}, path); } -export async function fileExists(path: string) { +export async function fileExists(path: string, inDataPath = true) { try { - await fs.access(getDataFilePathFor(path)); + await fs.access(inDataPath ? getDataFilePathFor(path) : path); return true; } catch { return false; diff --git a/src/lib/server/print/printers/serialPrinter.ts b/src/lib/server/print/printers/serialPrinter.ts index dbe5744..9573334 100644 --- a/src/lib/server/print/printers/serialPrinter.ts +++ b/src/lib/server/print/printers/serialPrinter.ts @@ -13,7 +13,7 @@ export class SerialPrinter extends Printer { */ public async print(zpl: string): Promise { const path = this.options.path; - if (!path || !(await fileExists(path))) { + if (!path || !(await fileExists(path, false))) { throw new Error(`${path} not found`); }