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.)
This commit is contained in:
2006-07-09 13:00:41 +00:00
parent cf313f867d
commit 1ce6c22f27
2 changed files with 23 additions and 26 deletions

View File

@@ -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 **************** */