== 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:
@@ -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__ */
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user