Makes a backup copy of the content file.

Before overwriting the existing content file, rename it
adding the .backup extension, but only if such content file
was read and validated.
This commit is contained in:
Andrea Mazzoleni 2014-06-13 18:23:24 +02:00
parent 68042d528d
commit da08ca4497
8 changed files with 49 additions and 16 deletions

View file

@ -298,6 +298,16 @@ int filter_content(tommy_list* contentlist, const char* path)
pathprint(tmp, sizeof(tmp), "%s.tmp", content->content);
if (pathcmp(tmp, path) == 0)
return -1;
/* exclude also the ".backup" copy */
pathprint(tmp, sizeof(tmp), "%s.backup", content->content);
if (pathcmp(tmp, path) == 0)
return -1;
/* exclude also the ".lock" file */
pathprint(tmp, sizeof(tmp), "%s.lock", content->content);
if (pathcmp(tmp, path) == 0)
return -1;
}
return 0;