mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
/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
This commit is contained in:
parent
642b4be1f2
commit
fb3072bbbb
1 changed files with 5 additions and 3 deletions
|
@ -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…
Add table
Reference in a new issue