[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [14619] trunk/blender/source/blender: == bugfix ==

Andrea Weikert elubie at gmx.net
Tue Apr 29 23:43:17 CEST 2008


Revision: 14619
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14619
Author:   elubie
Date:     2008-04-29 23:43:17 +0200 (Tue, 29 Apr 2008)

Log Message:
-----------
== bugfix ==
fix for [#6580] invalid file names not handled consistently when saving
only affects windows, where invisible file stream could be created if filename contains ':'

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/BLI_winstuff.h
    trunk/blender/source/blender/blenlib/intern/winstuff.c
    trunk/blender/source/blender/src/filesel.c

Modified: trunk/blender/source/blender/blenlib/BLI_winstuff.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_winstuff.h	2008-04-29 19:51:23 UTC (rev 14618)
+++ trunk/blender/source/blender/blenlib/BLI_winstuff.h	2008-04-29 21:43:17 UTC (rev 14619)
@@ -110,7 +110,8 @@
 DIR *opendir (const char *path);
 struct dirent *readdir(DIR *dp);
 int closedir (DIR *dp);
-void get_default_root(char* root);
+void get_default_root(char *root);
+int check_file_chars(char *filename);
 
 #endif /* __WINSTUFF_H__ */
 

Modified: trunk/blender/source/blender/blenlib/intern/winstuff.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/winstuff.c	2008-04-29 19:51:23 UTC (rev 14618)
+++ trunk/blender/source/blender/blenlib/intern/winstuff.c	2008-04-29 21:43:17 UTC (rev 14619)
@@ -196,6 +196,27 @@
 	}
 }
 
+int check_file_chars(char *filename)
+{
+	char *p = filename;
+	while (*p) {
+		switch (*p) {
+			case ':':
+			case '?':
+			case '*':
+			case '|':
+			case '\\':
+			case '/':
+			case '\"':
+				return 0;
+				break;
+		}
+
+		p++;
+	}
+	return 1;
+}
+
 #else
 
 static void BLI_WINSTUFF_C_IS_EMPTY_FOR_UNIX(void) 

Modified: trunk/blender/source/blender/src/filesel.c
===================================================================
--- trunk/blender/source/blender/src/filesel.c	2008-04-29 19:51:23 UTC (rev 14618)
+++ trunk/blender/source/blender/src/filesel.c	2008-04-29 21:43:17 UTC (rev 14619)
@@ -1420,6 +1420,16 @@
 		return;
 	}
 	
+#ifdef WIN32
+	if ( (sfile->type!=FILE_LOADLIB) && (sfile->type!=FILE_MAIN) ) {
+		if (!check_file_chars(sfile->file)) {
+			error("You have illegal characters in the filename. Check console for more info.");
+			printf("Characters '*?:|\"<>\\/' are illegal in a filename.\n");
+			return;
+		}
+	}
+#endif
+
 	filesel_prevspace();
 
 	if(sfile->type==FILE_LOADLIB) {





More information about the Bf-blender-cvs mailing list