comparison src/recentfiles.cpp @ 383:1affc7820bef

Strip trailing slash before adding to recent files
author Chris Cannam
date Thu, 19 May 2011 09:25:54 +0100
parents b9c153e00e84
children 533519ebc0cb
comparison
equal deleted inserted replaced
382:f7dc2c5d8650 383:1affc7820bef
120 void 120 void
121 RecentFiles::addFile(QString name) 121 RecentFiles::addFile(QString name)
122 { 122 {
123 static QRegExp schemeRE("^[a-zA-Z]{2,5}://"); 123 static QRegExp schemeRE("^[a-zA-Z]{2,5}://");
124 static QRegExp tempRE("[\\/][Tt]e?mp[\\/]"); 124 static QRegExp tempRE("[\\/][Tt]e?mp[\\/]");
125 if (name.endsWith("/")) {
126 name = name.left(name.length()-1);
127 }
128 if (name == "") {
129 return;
130 }
125 if (schemeRE.indexIn(name) == 0) { 131 if (schemeRE.indexIn(name) == 0) {
126 add(name); 132 add(name);
127 } else { 133 } else {
128 QString absPath = QFileInfo(name).absoluteFilePath(); 134 QString absPath = QFileInfo(name).absoluteFilePath();
129 if (tempRE.indexIn(absPath) != -1) { 135 if (tempRE.indexIn(absPath) != -1) {