From 2208632154d4fb044fbcdbf2f1a86d3f10a394cf Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 23 May 2026 01:10:10 +0200 Subject: [PATCH] ux(log): default fileuploader.log path is now the user's Desktop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In packaged builds path.dirname(process.execPath) resolves to %LOCALAPPDATA%\Programs\Multi-Hoster-Upload — a hidden install directory the user never visits and that NSIS may prune on uninstall. Existing files written there were effectively invisible. Change the unconfigured-default to app.getPath('desktop') instead. If Desktop isn't available (rare), fall back to userData (Roaming), and finally to the exe dir as a last resort. Dev mode (isPackaged false) is unchanged — keeps the project dir for inspection. Custom log paths set via the Settings UI override this and continue to work as before. Existing users with old logs in the install dir will just see a new fileuploader.log on the Desktop going forward; the old file stays where it is (not auto-migrated). 137/137 tests still green. --- main.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) 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() {