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:
authorJoerg Mueller <nexyon@gmail.com>2011-07-30 01:28:18 +0400
committerJoerg Mueller <nexyon@gmail.com>2011-07-30 01:28:18 +0400
commit29f214f7f31bf7490b0c2795ad716ce5a9dc1818 (patch)
treefa9cb969c253e58c71c0dd61e89731f185849030 /source/blender/editors/space_text
parentce1c78e18bf41115a8a149dd85115292c1919bea (diff)
parent6a27da310c61b3372d565060506221a5afb9fe43 (diff)
Merging up to trunk r38834.
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/text_ops.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 2bd6bd624df..13eb24ed1f2 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <ctype.h> /* ispunct */
#include <sys/stat.h>
+#include <errno.h>
#include "MEM_guardedalloc.h"
@@ -449,15 +450,14 @@ static void txt_write_file(Text *text, ReportList *reports)
FILE *fp;
TextLine *tmp;
struct stat st;
- int res;
- char file[FILE_MAXDIR+FILE_MAXFILE];
+ char filepath[FILE_MAXDIR+FILE_MAXFILE];
- BLI_strncpy(file, text->name, FILE_MAXDIR+FILE_MAXFILE);
- BLI_path_abs(file, G.main->name);
+ BLI_strncpy(filepath, text->name, FILE_MAXDIR+FILE_MAXFILE);
+ BLI_path_abs(filepath, G.main->name);
- fp= fopen(file, "w");
+ fp= fopen(filepath, "w");
if(fp==NULL) {
- BKE_report(reports, RPT_ERROR, "Unable to save file.");
+ BKE_reportf(reports, RPT_ERROR, "Unable to save \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error writing file");
return;
}
@@ -471,8 +471,13 @@ static void txt_write_file(Text *text, ReportList *reports)
fclose (fp);
- res= stat(file, &st);
- text->mtime= st.st_mtime;
+ if(stat(filepath, &st) == 0) {
+ text->mtime= st.st_mtime;
+ }
+ else {
+ text->mtime= 0;
+ BKE_reportf(reports, RPT_WARNING, "Unable to stat \"%s\": %s.", filepath, errno ? strerror(errno) : "Unknown error starrng file");
+ }
if(text->flags & TXT_ISDIRTY)
text->flags ^= TXT_ISDIRTY;