From 90dddeb4cc90093ab42687bbda7cd7a5428355c2 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sun, 16 Feb 2014 13:25:02 -0800 Subject: Rename old 'xml' file as 'bak' file when saving If you use the standard naming convention and end your subsurface filename in ".xml", we will now save away any previous xml file as a "bak" file before writing a new one. This can be useful for: - recovering from mistakes that deleted old dives - seeing what changed (ie you can do things like "diff -u xyz.bak xyz.xml") after doing some operation and saving the result. However, this does only a single level of backups - if you save twice, you will obviously have lost the original. I'd strongly encourage some external backup system in addition to this very simplistic backup. Signed-off-by: Linus Torvalds Signed-off-by: Dirk Hohndel --- macos.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'macos.c') diff --git a/macos.c b/macos.c index ba461ee4f..aa5036ea2 100644 --- a/macos.c +++ b/macos.c @@ -82,6 +82,11 @@ int enumerate_devices (device_callback_t callback, void *userdata) } /* NOP wrappers to comform with windows.c */ +int subsurface_rename(const char *path, const char *newpath) +{ + return rename(path, newpath); +} + int subsurface_open(const char *path, int oflags, mode_t mode) { return open(path, oflags, mode); -- cgit v1.2.3-70-g09d2