[vlmc-devel] project name should not contain special characters

Sanket Markan git at videolan.org
Fri Mar 25 15:28:04 CET 2016


vlmc | branch: master | Sanket Markan <sanketmarkan at gmail.com> | Thu Mar 17 15:43:43 2016 +0530| [3b045e8d57c4bffe9a8757fe7848aad2d7b49d2a] | committer: Hugo Beauzée-Luyssen

project name should not contain special characters

problems may exist for instance adding / to project name make half of name a directory

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> https://code.videolan.org/videolan/vlmc/commit/3b045e8d57c4bffe9a8757fe7848aad2d7b49d2a
---

 src/Gui/wizard/GeneralPage.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/Gui/wizard/GeneralPage.cpp b/src/Gui/wizard/GeneralPage.cpp
index da986ba..c1fc561 100644
--- a/src/Gui/wizard/GeneralPage.cpp
+++ b/src/Gui/wizard/GeneralPage.cpp
@@ -87,6 +87,7 @@ GeneralPage::validatePage()
     if ( m_valid == false )
         return false;
     const QString       &defaultProjectName = Project::unNamedProject;
+    QString invalid_char = "/?:*\\|";
     if ( ui.lineEditName->text().isEmpty() ||
          ui.lineEditName->text() == defaultProjectName )
     {
@@ -95,6 +96,14 @@ GeneralPage::validatePage()
         ui.lineEditName->setFocus();
         return false;
     }
+    for ( int i = 0; i < invalid_char.length() ; ++i )
+        if ( ui.lineEditName->text().contains( invalid_char[i] ) )
+        {
+            QMessageBox::information( this, tr( "Invalid project name" ),
+                                      tr( "Special characters are not allowed" ) );
+            ui.lineEditName->setFocus();
+            return false;
+        }
 
     //Create the project directory in the workspace dir.
     QString     projectPath = ui.lineEditName->text().replace( ' ', '_' );



More information about the Vlmc-devel mailing list