From 505f8d16b82107fc905838bd6734b3264f2a6b1e Mon Sep 17 00:00:00 2001 From: Observer KRypt0n_ Date: Thu, 17 Feb 2022 18:29:10 +0200 Subject: [PATCH] Fixed an issue with log files' name generation It seems that on some specific file systems(?) `stat -c '%W' ` returns `0` as a file creation timestamp --- src/index.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.svelte b/src/index.svelte index b83a673..3c2e21c 100644 --- a/src/index.svelte +++ b/src/index.svelte @@ -28,7 +28,10 @@ constants.paths.launcherDir.then((launcherDir) => { Neutralino.filesystem.getStats(`${launcherDir}/logs/latest.log`) .then(async () => { - const created_at = (await Neutralino.os.execCommand(`stat -c '%W' "${path.addSlashes(`${launcherDir}/logs/latest.log`)}"`)).stdOut; + let created_at = (await Neutralino.os.execCommand(`stat -c '%W' "${path.addSlashes(`${launcherDir}/logs/latest.log`)}"`)).stdOut; + + if (!created_at) + created_at = Date.now() / 1000; Neutralino.filesystem.moveFile(`${launcherDir}/logs/latest.log`, `${launcherDir}/logs/${getLogFilename(new Date(created_at * 1000))}`); })