ludusavi: Backup and restore does not record / recreate file modification times

Ludusavi version

v0.13.1

Operating system

Linux

Installation method

Other

Description

Factorio offers the option to continue the game with the last saved game. It identifies it by looking at the file modification. Ludusavi does not record the file modification time during backup and does not set it during restore and Factorio offers a seemingly randomly selected savegame to continue.

E.g. that means

$ cd Factorio
$ ls saves
...
-rw-r----- 1 MYUSER MYUSER  6176539 Sep 30 07:38 atomic 01.zip
-rw-r--r-- 1 MYUSER MYUSER 22911720 Sep 30 07:29 free 02.zip
...
$ ludusavi backup Factorio
$ ludusavi restore Factorio
$ ls saves
...
-rw-r----- 1 MYUSER MYUSER  6176539 Sep 30 07:39 atomic 01.zip
-rw-r--r-- 1 MYUSER MYUSER 22911720 Sep 30 07:39 free 02.zip
...

Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (19 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks for accepting my pull request!

This one let’s it run and generate a cache.yaml:

diff --git a/src/cache.rs b/src/cache.rs
index c7a2d7f..b1fa343 100644
--- a/src/cache.rs
+++ b/src/cache.rs
@@ -41,7 +41,7 @@ impl Cache {
     pub fn save(&self) {
         let new_content = serde_yaml::to_string(&self).unwrap();
 
-        let old_content = Self::load_raw().unwrap();
+        let old_content = Self::load_raw().unwrap_or_default();
         if old_content == new_content {
             return;
         }

Thanks for the pointers to the code, I will give it a try.