From dcd08b73ecb2728043cdf5a60fbfbb811b101d59 Mon Sep 17 00:00:00 2001 From: Valerio Valerio Date: Sun, 28 Feb 2010 17:33:35 +0000 Subject: [PATCH] Fixed "file with spaces in the name" bug, boot player can't read these --- bootscreen.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bootscreen.cpp b/bootscreen.cpp index ae1a04b..d80a8ae 100644 --- a/bootscreen.cpp +++ b/bootscreen.cpp @@ -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) -- 1.7.9.5