Skip to content

Commit

Permalink
Removed broken log path settings and log cleanup on exit in main.js
Browse files Browse the repository at this point in the history
Fixed "export audio clips"
  • Loading branch information
Mattk70 committed Oct 17, 2024
1 parent b78ffbf commit 1c5a49c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
2 changes: 1 addition & 1 deletion js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2736,7 +2736,7 @@ const getResults = async ({
//const dateString = new Date(r.timestamp).toISOString().replace(/[TZ]/g, ' ').replace(/\.\d{3}/, '').replace(/[-:]/g, '-').trim();
const filename = `${r.cname}_${dateString}.${STATE.audio.format}`
DEBUG && console.log(`Exporting from ${r.file}, position ${r.position}, into folder ${directory}`)
saveAudio(r.file, r.position, r.end, filename, metadata, directory)
saveAudio(r.file, r.position, r.end, filename, {Artist: 'Chirpity'}, directory)
i === result.length - 1 && UI.postMessage({ event: 'generate-alert', message: `${result.length} files saved` })
}
}
Expand Down
43 changes: 19 additions & 24 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@ async function fetchReleaseNotes(version) {




log.transports.file.resolvePathFn = () => path.join(APP_DATA, 'logs/main.log');
log.info('App starting...');


autoUpdater.on('checking-for-update', function () {
logUpdateStatus('Checking for update...');
if (process.env.PORTABLE_EXECUTABLE_DIR){
Expand Down Expand Up @@ -177,23 +172,23 @@ async function exitHandler(options, exitCode) {
}
});
});
// Remove old logs
const logs = path.join(app.getPath('userData'), 'logs');
fs.readdir(logs, (err, files) => {
if (err) {
console.error('Error reading folder:', err);
return;
}
files.forEach((file) => {
fs.unlink(path.join(logs, file), (err) => {
if (err) {
console.error('Error deleting file:', err);
} else {
console.log('Deleted file:', file);
}
});
});
});
// Remove old logs - commented out as logs are rotated
// const logs = path.join(app.getPath('userData'), 'logs');
// fs.readdir(logs, (err, files) => {
// if (err) {
// console.error('Error reading folder:', err);
// return;
// }
// files.forEach((file) => {
// fs.unlink(path.join(logs, file), (err) => {
// if (err) {
// console.error('Error deleting file:', err);
// } else {
// console.log('Deleted file:', file);
// }
// });
// });
// });
// Disable debug mode here?
} else {
console.log('no clean')
Expand Down Expand Up @@ -246,7 +241,7 @@ async function windowStateKeeper(windowName) {
windowState.isMaximized = window.isMaximized();
try {
await settings.set(`windowState.${windowName}`, windowState);
} catch (error){}
} catch {} // do nothing
}

function track(win) {
Expand Down Expand Up @@ -293,7 +288,7 @@ async function createWindow() {
// Set icon
mainWindow.setIcon(__dirname + '/img/icon/icon.png');

// Hide nav bar excpet in ci mode
// Hide nav bar except in ci mode

mainWindow.setMenuBarVisibility(!!process.env.CI);

Expand Down

0 comments on commit 1c5a49c

Please sign in to comment.