Only use libblkid on Linux.
This commit is contained in:
parent
838150d439
commit
f98dbcc208
|
@ -77,9 +77,10 @@ add_definitions(
|
|||
)
|
||||
kde_enable_exceptions()
|
||||
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(BLKID REQUIRED blkid>=2.30)
|
||||
if(LINUX)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(BLKID REQUIRED blkid>=2.30)
|
||||
endif()
|
||||
|
||||
include_directories(${Qt5Core_INCLUDE_DIRS} ${UUID_INCLUDE_DIRS} ${BLKID_INCLUDE_DIRS} lib/ src/)
|
||||
|
||||
|
|
|
@ -20,7 +20,9 @@
|
|||
#include "core/fstab.h"
|
||||
#include "util/externalcommand.h"
|
||||
|
||||
#include <blkid/blkid.h>
|
||||
#if defined(Q_OS_LINUX)
|
||||
#include <blkid/blkid.h>
|
||||
#endif
|
||||
|
||||
#include <QChar>
|
||||
#include <QDebug>
|
||||
|
@ -118,10 +120,12 @@ static QString findBlkIdDevice(const QString& token, const QString& value)
|
|||
{
|
||||
QString rval;
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
if (char* c = blkid_evaluate_tag(token.toLocal8Bit().constData(), value.toLocal8Bit().constData(), nullptr)) {
|
||||
rval = QString::fromLocal8Bit(c);
|
||||
free(c);
|
||||
}
|
||||
#endif
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue