Add exclusion for QB on non-windows.

This commit is contained in:
Patrick Fic
2025-03-27 12:43:27 -07:00
parent 7d59796f49
commit ecab1e8f05
2 changed files with 23 additions and 4 deletions

View File

@@ -25,8 +25,7 @@
"@electron-toolkit/utils": "^4.0.0",
"electron-log": "^5.3.2",
"electron-store": "^8.2.0",
"electron-updater": "^6.3.9",
"winax": "^3.6.1"
"electron-updater": "^6.3.9"
},
"devDependencies": {
"@ant-design/v5-patch-for-react-19": "^1.0.3",
@@ -72,5 +71,8 @@
"redux-thunk": "^3.1.0",
"typescript": "^5.8.2",
"vite": "^6.2.1"
},
"optionalDependencies": {
"winax": "^3.1.4"
}
}

View File

@@ -1,4 +1,3 @@
import * as Winax from "winax";
import log from "electron-log/main";
import { Request, Response } from "express";
@@ -7,11 +6,25 @@ import errorTypeCheck from "../../util/errorTypeCheck";
import _ from "lodash";
import store from "../store/store";
let Winax: any; // Declare Winax as any to avoid TypeScript errors on non-Windows platforms
if (process.platform === "win32") {
Winax = require("winax");
}
export async function handleQuickBookRequest(
req: Request,
res: Response,
): Promise<void> {
//TODO: Add OS sysstem checking. This can only happen on windows machines.
if (process.platform !== "win32") {
res
.status(500)
.json({
error: "QuickBooks Desktop integration is only available on Windows",
});
return;
}
const QbFilePath: string = `C:\\Users\\PatrickFic\\Development\\FRODO COLLISION.QBW`;
// ||
// (store.get("settings.qbFilePath") as string) F
@@ -81,6 +94,10 @@ export async function handleQuickBookRequest(
//This set of functions works.
export function TestQB(): void {
if (process.platform !== "win32") {
log.warn("TestQB is only available on Windows");
return;
}
let requestProcessor, ticket;
try {
requestProcessor = new Winax.Object("QBXMLRP.RequestProcessor.1");