== 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 ':'
This commit is contained in:
2008-04-29 21:43:17 +00:00
parent 4be6ef5758
commit b1d841f2c4
3 changed files with 33 additions and 1 deletions

View File

@@ -110,7 +110,8 @@ void RegisterBlendExtension(char * str);
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__ */

View File

@@ -196,6 +196,27 @@ void get_default_root(char* root) {
}
}
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)

View File

@@ -1420,6 +1420,16 @@ static void filesel_execute(SpaceFile *sfile)
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) {