forked from bartvdbraak/blender
Fixed own platform bug with stat/fstat.
This commit is contained in:
parent
ab6e6b4c41
commit
14c1ed0810
@ -217,7 +217,7 @@ int reopen_text(Text *text)
|
|||||||
TextLine *tmp;
|
TextLine *tmp;
|
||||||
char sfile[FILE_MAXFILE];
|
char sfile[FILE_MAXFILE];
|
||||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||||
struct stat fst;
|
struct stat st;
|
||||||
|
|
||||||
if (!text || !text->name) return 0;
|
if (!text || !text->name) return 0;
|
||||||
|
|
||||||
@ -254,9 +254,6 @@ int reopen_text(Text *text)
|
|||||||
|
|
||||||
text->undo_pos= -1;
|
text->undo_pos= -1;
|
||||||
|
|
||||||
res= fstat(fp->_file, &fst);
|
|
||||||
text->mtime= fst.st_mtime;
|
|
||||||
|
|
||||||
buffer= MEM_mallocN(len, "text_buffer");
|
buffer= MEM_mallocN(len, "text_buffer");
|
||||||
// under windows fread can return less then len bytes because
|
// under windows fread can return less then len bytes because
|
||||||
// of CR stripping
|
// of CR stripping
|
||||||
@ -264,6 +261,9 @@ int reopen_text(Text *text)
|
|||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
res= stat(str, &st);
|
||||||
|
text->mtime= st.st_mtime;
|
||||||
|
|
||||||
text->nlines=0;
|
text->nlines=0;
|
||||||
i=0;
|
i=0;
|
||||||
llen=0;
|
llen=0;
|
||||||
@ -320,7 +320,7 @@ Text *add_text(char *file)
|
|||||||
Text *ta;
|
Text *ta;
|
||||||
char sfile[FILE_MAXFILE];
|
char sfile[FILE_MAXFILE];
|
||||||
char str[FILE_MAXDIR+FILE_MAXFILE];
|
char str[FILE_MAXDIR+FILE_MAXFILE];
|
||||||
struct stat fst;
|
struct stat st;
|
||||||
|
|
||||||
BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
|
BLI_strncpy(str, file, FILE_MAXDIR+FILE_MAXFILE);
|
||||||
if (G.scene) /* can be NULL (bg mode) */
|
if (G.scene) /* can be NULL (bg mode) */
|
||||||
@ -346,9 +346,6 @@ Text *add_text(char *file)
|
|||||||
ta->name= MEM_mallocN(strlen(file)+1, "text_name");
|
ta->name= MEM_mallocN(strlen(file)+1, "text_name");
|
||||||
strcpy(ta->name, file);
|
strcpy(ta->name, file);
|
||||||
|
|
||||||
res= fstat(fp->_file, &fst);
|
|
||||||
ta->mtime= fst.st_mtime;
|
|
||||||
|
|
||||||
ta->undo_pos= -1;
|
ta->undo_pos= -1;
|
||||||
ta->undo_len= TXT_INIT_UNDO;
|
ta->undo_len= TXT_INIT_UNDO;
|
||||||
ta->undo_buf= MEM_mallocN(ta->undo_len, "undo buf");
|
ta->undo_buf= MEM_mallocN(ta->undo_len, "undo buf");
|
||||||
@ -360,6 +357,9 @@ Text *add_text(char *file)
|
|||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
res= stat(str, &st);
|
||||||
|
ta->mtime= st.st_mtime;
|
||||||
|
|
||||||
ta->nlines=0;
|
ta->nlines=0;
|
||||||
i=0;
|
i=0;
|
||||||
llen=0;
|
llen=0;
|
||||||
|
@ -1316,7 +1316,7 @@ void txt_write_file(Text *text)
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
TextLine *tmp;
|
TextLine *tmp;
|
||||||
int res;
|
int res;
|
||||||
struct stat fst;
|
struct stat st;
|
||||||
|
|
||||||
/* Do we need to get a filename? */
|
/* Do we need to get a filename? */
|
||||||
if (text->flags & TXT_ISMEM) {
|
if (text->flags & TXT_ISMEM) {
|
||||||
@ -1352,8 +1352,8 @@ void txt_write_file(Text *text)
|
|||||||
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
res= stat(text->name, &fst);
|
res= stat(text->name, &st);
|
||||||
text->mtime= fst.st_mtime;
|
text->mtime= st.st_mtime;
|
||||||
|
|
||||||
if (text->flags & TXT_ISDIRTY) text->flags ^= TXT_ISDIRTY;
|
if (text->flags & TXT_ISDIRTY) text->flags ^= TXT_ISDIRTY;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user