/etc/mtab reports a file size of 0, so using .atEnd() may not work. Read the file until it doesn't return more data.

Use QTextStream because it takes care of the conversion between 8-bit and 16-bit.
http://doc.qt.io/qt-5/qfile.html#using-streams-to-read-files
main
Ramon Buldó 10 years ago
parent 642b4be1f2
commit fb3072bbbb

@ -49,10 +49,11 @@ ClearTempMountsJob::exec()
return Calamares::JobResult::error( tr( "Cannot get list of temporary mounts." ) );
cDebug() << "Opened mtab. Lines:";
while ( !mtab.atEnd() )
QTextStream in(&mtab);
QString lineIn = in.readLine();
while ( !lineIn.isNull() )
{
QStringList line = QString::fromLocal8Bit( mtab.readLine() )
.split( ' ', QString::SkipEmptyParts );
QStringList line = lineIn.split( ' ', QString::SkipEmptyParts );
cDebug() << line.join( ' ' );
QString device = line.at( 0 );
QString mountPoint = line.at( 1 );
@ -61,6 +62,7 @@ ClearTempMountsJob::exec()
cDebug() << "INSERTING pair (device, mountPoint)" << device << mountPoint;
lst.append( qMakePair( device, mountPoint ) );
}
lineIn = in.readLine();
}
qSort( lst.begin(), lst.end(), []( const QPair< QString, QString >& a,

Loading…
Cancel
Save