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:
authorTon Roosendaal <ton@blender.org>2006-07-09 17:00:41 +0400
committerTon Roosendaal <ton@blender.org>2006-07-09 17:00:41 +0400
commit1ce6c22f2700b2473f5ad8e0c79ff5802fb65a62 (patch)
treefa4c18e789a0cc7746c5eb03c73c78c82ca9bd98 /source/blender/src/toolbox.c
parentcf313f867d3e457ac9da21c001202650d4a8e2ce (diff)
Bugfix #4649
Three issues: - When saving a file, without extension added, and no filename provided, the saving code received the directory name only. That's a potential danger of getting directories deleted. Added in the saveover() function a check for this, and return an error when you try to save over a directory. - Screendump did not add file extensions yet, when indicated todo so. - Screendump code was duplicating all image type cases, whilst we have a nice BKE_write_ibuf() call for that now. (Bug was that this code did not check for BMP, saving the file in default format.)
Diffstat (limited to 'source/blender/src/toolbox.c')
-rw-r--r--source/blender/src/toolbox.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 1313dfc4a45..218252704e4 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -232,7 +232,20 @@ void error(char *fmt, ...)
int saveover(char *file)
{
- return (!BLI_exists(file) || confirm("Save over", file));
+ int len= strlen(file);
+
+ if(len==0)
+ return 0;
+
+ if(BLI_exists(file)==0)
+ return 1;
+
+ if( file[len-1]=='/' || file[len-1]=='\\' ) {
+ error("Cannot overwrite a directory");
+ return 0;
+ }
+
+ return confirm("Save over", file);
}
/* ****************** EXTRA STUFF **************** */