Skip to content

Commit

Permalink
fixed serial printer file not found bug
Browse files Browse the repository at this point in the history
  • Loading branch information
enoy19 committed Aug 27, 2023
1 parent e13e88b commit 043eee4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/lib/server/fileUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/server/print/printers/serialPrinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class SerialPrinter extends Printer {
*/
public async print(zpl: string): Promise<void> {
const path = this.options.path;
if (!path || !(await fileExists(path))) {
if (!path || !(await fileExists(path, false))) {
throw new Error(`${path} not found`);
}

Expand Down

0 comments on commit 043eee4

Please sign in to comment.