summaryrefslogtreecommitdiff
path: root/library/storage.cpp
Side-by-side diff
Diffstat (limited to 'library/storage.cpp') (more/less context) (show whitespace changes)
-rw-r--r--library/storage.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/library/storage.cpp b/library/storage.cpp
index dc5cc22..f8b75d0 100644
--- a/library/storage.cpp
+++ b/library/storage.cpp
@@ -36,6 +36,15 @@
+#ifdef Q_OS_MACX
+# include <sys/param.h>
+# include <sys/ucred.h>
+# include <sys/mount.h>
+# include <stdio.h> // For strerror()
+# include <errno.h>
+#endif /* Q_OS_MACX */
+
#include <qstringlist.h>
-#include <sys/vfs.h>
-#include <mntent.h>
+// Shouldn't be here ! (eilers)
+// #include <sys/vfs.h>
+// #include <mntent.h>
@@ -44,2 +53,4 @@ static bool isCF(const QString& m)
{
+
+#ifndef Q_OS_MACX
FILE* f = fopen("/var/run/stab", "r");
@@ -63,2 +74,3 @@ static bool isCF(const QString& m)
}
+#endif /* Q_OS_MACX */
return FALSE;
@@ -208,2 +220,19 @@ bool deviceTab( const char *device) {
bool hasDevice=false;
+
+#ifdef Q_OS_MACX
+ // Darwin (MacOS X)
+ struct statfs** mntbufp;
+ int count = 0;
+ if ( ( count = getmntinfo( mntbufp, MNT_WAIT ) ) == 0 ){
+ qWarning("deviceTab: Error in getmntinfo(): %s",strerror( errno ) );
+ hasDevice = false;
+ }
+ for( int i = 0; i < count; i++ ){
+ QString deviceName = mntbufp[i]->f_mntfromname;
+ qDebug(deviceName);
+ if( deviceName.left( name.length() ) == name )
+ hasDevice = true;
+ }
+#else
+ // Linux
struct mntent *me;
@@ -220,2 +249,5 @@ bool deviceTab( const char *device) {
endmntent( mntfp );
+#endif /* Q_OS_MACX */
+
+
return hasDevice;