summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-10-13 16:26:38 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-10-13 16:26:38 +0000
commitb5e7261dba931b8e6f33cf8559d9a822c2474f5a (patch)
tree9686eb601e9ad30619a25cd7962e9981bb1cd813
parentb7a4e101cb1bc8b01a1e6182939a33919814664f (diff)
downloadrockbox-b5e7261dba931b8e6f33cf8559d9a822c2474f5a.tar.gz
rockbox-b5e7261dba931b8e6f33cf8559d9a822c2474f5a.tar.bz2
rockbox-b5e7261dba931b8e6f33cf8559d9a822c2474f5a.zip
FS#7913: mountpoint resolving on OS X.
Also, make rbutil build again for OS X and add /usr/local to the lib and include paths since that is most likely where libusb will be. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15096 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--rbutil/rbutilqt/autodetection.cpp34
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro2
2 files changed, 30 insertions, 6 deletions
diff --git a/rbutil/rbutilqt/autodetection.cpp b/rbutil/rbutilqt/autodetection.cpp
index f2ba8df756..97963d4190 100644
--- a/rbutil/rbutilqt/autodetection.cpp
+++ b/rbutil/rbutilqt/autodetection.cpp
@@ -26,6 +26,11 @@
#if defined(Q_OS_LINUX)
#include <mntent.h>
#endif
+#if defined(Q_OS_MACX)
+#include <sys/param.h>
+#include <sys/ucred.h>
+#include <sys/mount.h>
+#endif
#if defined(Q_OS_WIN32)
#if defined(UNICODE)
#define _UNICODE
@@ -163,20 +168,24 @@ bool Autodetection::detect()
QStringList Autodetection::getMountpoints()
{
-#if defined(Q_OS_WIN32)
QStringList tempList;
+#if defined(Q_OS_WIN32)
QFileInfoList list = QDir::drives();
for(int i=0; i<list.size();i++)
{
tempList << list.at(i).absolutePath();
}
- return tempList;
#elif defined(Q_OS_MACX)
- QDir dir("/Volumes");
- return dir.entryList();
+ int num;
+ struct statfs *mntinf;
+
+ num = getmntinfo(&mntinf, MNT_WAIT);
+ while(num--) {
+ tempList << QString(mntinf->f_mntonname);
+ mntinf++;
+ }
#elif defined(Q_OS_LINUX)
- QStringList tempList;
FILE *mn = setmntent("/etc/mtab", "r");
if(!mn)
@@ -187,10 +196,10 @@ QStringList Autodetection::getMountpoints()
tempList << QString(ent->mnt_dir);
endmntent(mn);
- return tempList;
#else
#error Unknown Plattform
#endif
+ return tempList;
}
QString Autodetection::resolveMountPoint(QString device)
@@ -213,6 +222,19 @@ QString Autodetection::resolveMountPoint(QString device)
endmntent(mn);
#endif
+
+#if defined(Q_OS_MACX)
+ int num;
+ struct statfs *mntinf;
+
+ num = getmntinfo(&mntinf, MNT_WAIT);
+ while(num--) {
+ if(QString(mntinf->f_mntfromname).startsWith(device)
+ && QString(mntinf->f_fstypename).contains("vfat", Qt::CaseInsensitive))
+ return QString(mntinf->f_mntonname);
+ mntinf++;
+ }
+#endif
return QString("");
}
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index a4cbb886e5..56ddf469f1 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -127,6 +127,8 @@ unix {
macx {
QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
CONFIG+=x86 ppc
+ LIBS += -L/usr/local/lib -framework IOKit
+ INCLUDEPATH += /usr/local/include
}
static {