MCPcopy Create free account
hub / github.com/CloudCompare/CloudCompare / IsValidFileName

Function IsValidFileName

qCC/mainwindow.cpp:10380–10389  ·  view source on GitHub ↗

Helper: check for a filename validity

Source from the content-addressed store, hash-verified

10378
10379//Helper: check for a filename validity
10380static bool IsValidFileName(QString filename)
10381{
10382#ifdef CC_WINDOWS
10383 QString sPattern("^(?!^(PRN|AUX|CLOCK\\$|NUL|CON|COM\\d|LPT\\d|\\..*)(\\..+)?$)[^\\x00-\\x1f\\\\?*:\\"";|/]+$");
10384#else
10385 QString sPattern("^(([a-zA-Z]:|\\\\)\\\\)?(((\\.)|(\\.\\.)|([^\\\\/:\\*\\?""\\|<>\\. ](([^\\\\/:\\*\\?""\\|<>\\. ])|([^\\\\/:\\*\\?""\\|<>]*[^\\\\/:\\*\\?""\\|<>\\. ]))?))\\\\)*[^\\\\/:\\*\\?""\\|<>\\. ](([^\\\\/:\\*\\?""\\|<>\\. ])|([^\\\\/:\\*\\?""\\|<>]*[^\\\\/:\\*\\?""\\|<>\\. ]))?$");
10386#endif
10387
10388 return QRegExp(sPattern).exactMatch(filename);
10389}
10390
10391void MainWindow::doActionSaveFile()
10392{

Callers 2

doActionSaveFileMethod · 0.85
doActionSaveProjectMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected