feature/IO-3205-Paint-Scale-Integrations: Checkpoint

This commit is contained in:
Dave Richer
2025-04-28 10:36:16 -04:00
parent fa0c6f7db3
commit cf8a19575f

View File

@@ -141,6 +141,11 @@ const inputTypeHandlers: Record<
// Check for files
const files = await fs.readdir(config.path!);
for (const file of files) {
// Only process XML files
if (!file.toLowerCase().endsWith(".xml")) {
continue;
}
const filePath = path.join(config.path!, file);
const stats = await fs.stat(filePath);
if (stats.isFile()) {
@@ -404,7 +409,12 @@ const outputTypeHandlers: Record<
// Save XML to file
const xmlString = doc.end({ prettyPrint: true });
const outputPath = path.join(config.path!, "PPGPaint.xml");
const timestamp = new Date()
.toISOString()
.replace(/[-:]/g, "")
.replace("T", "")
.substring(0, 14);
const outputPath = path.join(config.path!, `PPGPaint_${timestamp}.xml`);
await fs.writeFile(outputPath, xmlString);
log.info(`Saved PPG output XML to ${outputPath}`);
} catch (error) {
@@ -562,9 +572,7 @@ ipcMain.on(
ipcTypes.toMain.settings.paintScale.updateInputCron,
(_event, configs: PaintScaleConfig[]) => {
handlePaintScaleInputCron(configs).catch((error) => {
log.error(
`Error handling paint scale input cron for configs: ${error}`,
);
log.error(`Error handling paint scale input cron for configs: ${error}`);
});
},
);
@@ -572,10 +580,8 @@ ipcMain.on(
ipcMain.on(
ipcTypes.toMain.settings.paintScale.updateOutputCron,
(_event, configs: PaintScaleConfig[]) => {
handlePaintScaleOutputCron(configs).catch(error => {
log.error(
`Error handling paint scale output cron for configs: ${error}`,
);
handlePaintScaleOutputCron(configs).catch((error) => {
log.error(`Error handling paint scale output cron for configs: ${error}`);
});
},
);