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