Usability enhancement: Use wx GetForbiddenChars function to remove illegal filename characters from default template name.
I am working on getting the Windows Code::Blocks projects to save as a template without error or warnings.
The ":" in the CB project title is not allowed in filenames under windows.
This patch fixes that.
I have also done the patch in this Git Repo forked from "obfuscated/codeblocks_sf" Repo
https://github.com/stahta01/codeblocks_sf_tims/tree/build/templatesCode partly copied from the CB codesnippetstreectrl.cpp file.
Index: src/sdk/templatemanager.cpp
===================================================================
--- src/sdk/templatemanager.cpp (revision 9855)
+++ src/sdk/templatemanager.cpp (working copy)
@@ -263,8 +263,16 @@
return;
}
+ // get default template title
+ wxString title = prj->GetTitle();
+
+ // filter title, removing all illegal filename characters
+ wxFileName titleFileName(title) ;
+ wxString forbidden = titleFileName.GetForbiddenChars();
+ for (size_t i=0; i < forbidden.Length(); ++i)
+ title.Replace(wxString(forbidden[i]), wxT(""),true);
+
// check if it exists and ask a different title
- wxString title = prj->GetTitle();
while (true)
{
// ask for template title (unique)
Tim S.