mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Allow backups for .ssrf files as well
In commit 102bf768944b ("Rename old 'xml' file as 'bak' file when saving") Linus forgot about our other standard filename extension... Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
90dddeb4cc
commit
6424b162f0
1 changed files with 11 additions and 1 deletions
12
save-xml.c
12
save-xml.c
|
@ -613,10 +613,20 @@ void save_dives_logic(const char *filename, const bool select_only)
|
|||
{
|
||||
struct membuffer buf = {0};
|
||||
FILE *f;
|
||||
char extension[][5] = {"xml", "ssrf", ""};
|
||||
int i = 0;
|
||||
int flen = strlen(filename);
|
||||
|
||||
save_dives_buffer(&buf, select_only);
|
||||
/* Maybe we might want to make this configurable? */
|
||||
save_backup(filename, "xml", "bak");
|
||||
while (extension[i][0] != '\0') {
|
||||
int elen = strlen(extension[i]);
|
||||
if (strcasecmp(filename + flen - elen, extension[i]) == 0) {
|
||||
save_backup(filename, extension[i], "bak");
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
f = subsurface_fopen(filename, "w");
|
||||
if (f) {
|
||||
flush_buffer(&buf, f);
|
||||
|
|
Loading…
Add table
Reference in a new issue