Page 1 of 1

on_save event or similar mechanism ?

Posted: Fri Mar 08, 2019 12:57 pm
by SeigneurAo
Hello.

I'd like to add a save file backup functionality, so that every time a save or autosave is written, it is immediately replicated on another location, but it doesn't seem like there's any API event triggered when this happens.
Is there any plan to add such an event ?

Or does anyone have an idea how I might work around this, in order to achieve wanted behaviour ?
At first I thought I'd use one of the many ways one can monitor file changes on *nix systems, and fire the backup based on that, but all things considered I'd prefer something which doesn't rely on a given OS or file system for compatibiliy's sake, that's why I looked into the official API.
Regular sync on saves folder is another option, but I'd definitely prefer something that's tied to the game rather than the OS or filesystem, for the same reasons as stated above.

Thanks in advance !

Re: on_save event or similar mechanism ?

Posted: Fri Mar 08, 2019 3:09 pm
by steinio

Re: on_save event or similar mechanism ?

Posted: Fri Mar 08, 2019 3:22 pm
by SyncViews
Going with an external program is the way to go. Even if there was an on_save event, you don't have full disk access, no network access, and on a server it would try and operate with identical settings on every client machine and probably crash. The only kinda exception is the `game.server_save(name)` function which provides no feedback and has limited options as to where/how it saves.


Doing something as simple as making the save directory be a dropbox or other synronised location should work. Otherwise it is a fairly simple program to write, plenty of libraries around.

Re: on_save event or similar mechanism ?

Posted: Fri Mar 08, 2019 4:54 pm
by SeigneurAo
Thanks to you both for your valuable input. Guess I'll settle for an external approach then.