fixed electron build + implemented dynamic settings + custom user data folder

This commit is contained in:
X4Lo committed 2024-06-05 00:14:48 +01:00
1 parent 8958ead210
commit b872cd0733
14 files changed
+286 -81

No files matched your search

+31
View File
@@ -0,0 +1,31 @@
// logService.js
const fs = require('fs');
const util = require('util');
// Convert fs.writeFile to a promise-based function
const writeFile = util.promisify(fs.writeFile);
// Ensure the log file exists and is accessible
const logFilePath = 'showy.log';
fs.open(logFilePath, 'a', (err, fd) => {
if (err) {
console.error("Failed to open log file:", err);
} else {
fs.close(fd, (err) => {
if (err) console.error("Failed to close log file:", err);
});
}
});
// Asynchronous function to append a message to the log file
async function logToFile(message) {
try {
await writeFile(logFilePath, `${message}\n`, { flag: 'a' });
} catch (err) {
console.error("Failed to write to log file:", err);
}
}
module.exports = {
logToFile,
};