mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
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:
parent
b7a4e101cb
commit
b5e7261dba
2 changed files with 30 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
@ -212,6 +221,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("");
|
||||
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue