diff --git a/main.js b/main.js index 4838f03..e02b407 100644 --- a/main.js +++ b/main.js @@ -212,10 +212,22 @@ function normalizeApiError(payload, fallback) { } function getDefaultLogFilePath() { - const baseDir = app.isPackaged - ? path.dirname(process.execPath) - : path.join(__dirname); - return path.join(baseDir, 'fileuploader.log'); + // In packaged builds the exe dir is %LOCALAPPDATA%\Programs\Multi-Hoster-Upload + // — a hidden, install-managed location that NSIS may even prune on + // uninstall. Default to the user's Desktop so the file is actually + // findable; fall back to userData if Desktop isn't available, and + // finally to the project dir in dev mode. + if (app.isPackaged) { + try { + const desktop = app.getPath('desktop'); + if (desktop) return path.join(desktop, 'fileuploader.log'); + } catch {} + try { + return path.join(app.getPath('userData'), 'fileuploader.log'); + } catch {} + return path.join(path.dirname(process.execPath), 'fileuploader.log'); + } + return path.join(__dirname, 'fileuploader.log'); } function getBaseLogFilePath() {