diff options
author | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-02-23 11:24:04 +0100 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> | 2015-02-23 11:24:07 +0100 |
commit | d34353a065c443aac20376cbd88323480d769183 (patch) | |
tree | da5d86b51c2cf7023356551c4c980849b35bab14 /src/corelib/io/qstorageinfo_unix.cpp | |
parent | 4e40b1952695f0b1086ef7b88e8514bd18cf96bf (diff) | |
parent | 571908f7fc8f5e4ef9a4dfd90102566f6f0fcad2 (diff) |
Merge dev into 5.5
Change-Id: Id6dbbbfc542c214fe695c6795c6aaf23aedc1cd1
Diffstat (limited to 'src/corelib/io/qstorageinfo_unix.cpp')
-rw-r--r-- | src/corelib/io/qstorageinfo_unix.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/src/corelib/io/qstorageinfo_unix.cpp b/src/corelib/io/qstorageinfo_unix.cpp index 667301b516..7e23ac897d 100644 --- a/src/corelib/io/qstorageinfo_unix.cpp +++ b/src/corelib/io/qstorageinfo_unix.cpp @@ -59,6 +59,7 @@ # include <Path.h> # include <Volume.h> # include <VolumeRoster.h> +# include <fs_info.h> # include <sys/statvfs.h> #else # include <sys/statvfs.h> @@ -341,9 +342,18 @@ inline bool QStorageIterator::next() return false; const BPath path(&directory); + + fs_info fsInfo; + memset(&fsInfo, 0, sizeof(fsInfo)); + + if (fs_stat_dev(volume.Device(), &fsInfo) != 0) + return false; + m_rootPath = path.Path(); - m_fileSystemType = QByteArray(); // no public API to access it - m_device = QByteArray::number(static_cast<qint32>(volume.Device())); + m_fileSystemType = QByteArray(fsInfo.fsh_name); + + const QByteArray deviceName(fsInfo.device_name); + m_device = (deviceName.isEmpty() ? QByteArray::number(qint32(volume.Device())) : deviceName); return true; } @@ -444,6 +454,19 @@ static inline QString retrieveLabel(const QByteArray &device) if (fileInfo.isSymLink() && fileInfo.symLinkTarget().toLocal8Bit() == device) return fileInfo.fileName(); } +#elif defined Q_OS_HAIKU + fs_info fsInfo; + memset(&fsInfo, 0, sizeof(fsInfo)); + + int32 pos = 0; + dev_t dev; + while ((dev = next_dev(&pos)) >= 0) { + if (fs_stat_dev(dev, &fsInfo) != 0) + continue; + + if (qstrcmp(fsInfo.device_name, device.constData()) == 0) + return QString::fromLocal8Bit(fsInfo.volume_name); + } #else Q_UNUSED(device); #endif |