Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-02-03 09:06:42 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-02-03 09:10:35 +0300
commit3416428e0b069faa439e313f0a6c778faa7da6ba (patch)
treea748fe207abc57e7d10bf00b4cc51758e61a276c /source/blender
parent91bd58869c34d97e01823a3e04010e41724a7f68 (diff)
Recent BLI_rename fix introduced error w/ blend file versioning
Rename calls didn't check if the file existed first, so missing file was counted as success and ignored.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenloader/intern/writefile.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index a2802db0802..e8db2d3679b 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -3798,24 +3798,28 @@ static bool do_history(const char *name, ReportList *reports)
BKE_report(reports, RPT_ERROR, "Unable to make version backup: filename too short");
return 1;
}
-
+
while (hisnr > 1) {
BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr-1);
- BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr);
-
- if (BLI_rename(tempname1, tempname2)) {
- BKE_report(reports, RPT_ERROR, "Unable to make version backup");
- return 1;
+ if (BLI_exists(tempname1)) {
+ BLI_snprintf(tempname2, sizeof(tempname2), "%s%d", name, hisnr);
+
+ if (BLI_rename(tempname1, tempname2)) {
+ BKE_report(reports, RPT_ERROR, "Unable to make version backup");
+ return true;
+ }
}
hisnr--;
}
/* is needed when hisnr==1 */
- BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr);
+ if (BLI_exists(name)) {
+ BLI_snprintf(tempname1, sizeof(tempname1), "%s%d", name, hisnr);
- if (BLI_rename(name, tempname1)) {
- BKE_report(reports, RPT_ERROR, "Unable to make version backup");
- return 1;
+ if (BLI_rename(name, tempname1)) {
+ BKE_report(reports, RPT_ERROR, "Unable to make version backup");
+ return true;
+ }
}
return 0;