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
This commit is contained in:
Barry Wardell 2007-10-13 16:26:38 +00:00
parent b7a4e101cb
commit b5e7261dba
2 changed files with 30 additions and 6 deletions

View file

@ -26,6 +26,11 @@
#if defined(Q_OS_LINUX) #if defined(Q_OS_LINUX)
#include <mntent.h> #include <mntent.h>
#endif #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(Q_OS_WIN32)
#if defined(UNICODE) #if defined(UNICODE)
#define _UNICODE #define _UNICODE
@ -163,20 +168,24 @@ bool Autodetection::detect()
QStringList Autodetection::getMountpoints() QStringList Autodetection::getMountpoints()
{ {
#if defined(Q_OS_WIN32)
QStringList tempList; QStringList tempList;
#if defined(Q_OS_WIN32)
QFileInfoList list = QDir::drives(); QFileInfoList list = QDir::drives();
for(int i=0; i<list.size();i++) for(int i=0; i<list.size();i++)
{ {
tempList << list.at(i).absolutePath(); tempList << list.at(i).absolutePath();
} }
return tempList;
#elif defined(Q_OS_MACX) #elif defined(Q_OS_MACX)
QDir dir("/Volumes"); int num;
return dir.entryList(); struct statfs *mntinf;
num = getmntinfo(&mntinf, MNT_WAIT);
while(num--) {
tempList << QString(mntinf->f_mntonname);
mntinf++;
}
#elif defined(Q_OS_LINUX) #elif defined(Q_OS_LINUX)
QStringList tempList;
FILE *mn = setmntent("/etc/mtab", "r"); FILE *mn = setmntent("/etc/mtab", "r");
if(!mn) if(!mn)
@ -187,10 +196,10 @@ QStringList Autodetection::getMountpoints()
tempList << QString(ent->mnt_dir); tempList << QString(ent->mnt_dir);
endmntent(mn); endmntent(mn);
return tempList;
#else #else
#error Unknown Plattform #error Unknown Plattform
#endif #endif
return tempList;
} }
QString Autodetection::resolveMountPoint(QString device) QString Autodetection::resolveMountPoint(QString device)
@ -212,6 +221,19 @@ QString Autodetection::resolveMountPoint(QString device)
} }
endmntent(mn); 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 #endif
return QString(""); return QString("");

View file

@ -127,6 +127,8 @@ unix {
macx { macx {
QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk QMAKE_MAC_SDK=/Developer/SDKs/MacOSX10.4u.sdk
CONFIG+=x86 ppc CONFIG+=x86 ppc
LIBS += -L/usr/local/lib -framework IOKit
INCLUDEPATH += /usr/local/include
} }
static { static {