mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-01-12 20:07:20 +03:00
Fixed an issue with log files' name generation
It seems that on some specific file systems(?) `stat -c '%W' <file>` returns `0` as a file creation timestamp
This commit is contained in:
parent
1c944a3d86
commit
505f8d16b8
1 changed files with 4 additions and 1 deletions
|
@ -28,7 +28,10 @@
|
||||||
constants.paths.launcherDir.then((launcherDir) => {
|
constants.paths.launcherDir.then((launcherDir) => {
|
||||||
Neutralino.filesystem.getStats(`${launcherDir}/logs/latest.log`)
|
Neutralino.filesystem.getStats(`${launcherDir}/logs/latest.log`)
|
||||||
.then(async () => {
|
.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))}`);
|
Neutralino.filesystem.moveFile(`${launcherDir}/logs/latest.log`, `${launcherDir}/logs/${getLogFilename(new Date(created_at * 1000))}`);
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue