Fixed "file with spaces in the name" bug, boot player can't read these
authorValerio Valerio <vdv100@gmail.com>
Sun, 28 Feb 2010 17:33:35 +0000 (17:33 +0000)
committerValerio Valerio <vdv100@gmail.com>
Sun, 28 Feb 2010 17:33:35 +0000 (17:33 +0000)
bootscreen.cpp

index ae1a04b..d80a8ae 100644 (file)
@@ -153,7 +153,10 @@ void BootScreen::addVideo()
     if(filePath != ""){
         QFile fileCopy(filePath);
         QFileInfo fileInfo(filePath);
-        QString newFilePath = videosDir + fileInfo.fileName();
+        QString fileName = fileInfo.fileName();
+        //boot player can't read files with spaces in the name
+        fileName.replace(QString(" "), QString("_"));
+        QString newFilePath = videosDir + fileName;
         qDebug() << newFilePath << endl;
         qDebug() << fileInfo.size() << endl;
         if(fileInfo.size() > 11100000)
@@ -168,7 +171,7 @@ void BootScreen::addVideo()
             else{
                 bool result = fileCopy.copy(newFilePath);
                 if(result){
-                    list->addItem(QString("%1").arg(fileInfo.fileName()));
+                    list->addItem(QString("%1").arg(fileName));
                     //autoselect item, if not in random mode
                     if(!random){
                         QListWidgetItem *currentItem = list->item(list->count()-1);
@@ -329,8 +332,10 @@ void BootScreen::createFile(QString filename, int index)
             out << "filename=" << filePath << endl;
         }
     }
-    else
+    else{
+        qDebug() << filename << endl;
         qDebug() << "print a error" << endl;
+    }
 }
 
 void BootScreen::closeEvent(QCloseEvent *event)