[partition] Refactor check for ISO9660
This commit is contained in:
parent
75f1a05fec
commit
1a4a265262
@ -54,17 +54,22 @@ hasRootPartition( Device* device )
|
||||
}
|
||||
|
||||
static bool
|
||||
isIso9660( const Device* device )
|
||||
blkIdCheckIso9660( const QString& path )
|
||||
{
|
||||
QString path = device->deviceNode();
|
||||
if ( path.isEmpty() )
|
||||
return false;
|
||||
|
||||
QProcess blkid;
|
||||
blkid.start( "blkid", { path } );
|
||||
blkid.waitForFinished();
|
||||
QString output = QString::fromLocal8Bit( blkid.readAllStandardOutput() );
|
||||
if ( output.contains( "iso9660" ) )
|
||||
return output.contains( "iso9660" );
|
||||
}
|
||||
|
||||
static bool
|
||||
isIso9660( const Device* device )
|
||||
{
|
||||
const QString path = device->deviceNode();
|
||||
if ( path.isEmpty() )
|
||||
return false;
|
||||
if ( blkIdCheckIso9660( path ) )
|
||||
return true;
|
||||
|
||||
if ( device->partitionTable() &&
|
||||
@ -72,11 +77,7 @@ isIso9660( const Device* device )
|
||||
{
|
||||
for ( const Partition* partition : device->partitionTable()->children() )
|
||||
{
|
||||
path = partition->partitionPath();
|
||||
blkid.start( "blkid", { path } );
|
||||
blkid.waitForFinished();
|
||||
QString output = QString::fromLocal8Bit( blkid.readAllStandardOutput() );
|
||||
if ( output.contains( "iso9660" ) )
|
||||
if ( blkIdCheckIso9660( partition->partitionPath() ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user