bool NewFileDialog::GetIsFileNameValid(const wxFileName& fileName) const { if (!fileName.IsOk()) { return false; } // Check if the file name has illegal characters in it. wxString forbidden = fileName.GetForbiddenChars(); const wxArrayString dirs = fileName.GetDirs(); for (unsigned int i = 0; i < dirs.Count(); ++i) { for (unsigned int j = 0; j < dirs[i].Length(); ++j) { if (forbidden.Find(dirs[i][j]) != wxNOT_FOUND) { return false; } } } wxString fullName = fileName.GetFullName(); for (unsigned int j = 0; j < fullName.Length(); ++j) { if (forbidden.Find(fullName[j]) != wxNOT_FOUND) { return false; } } return true; }