diff options
Diffstat (limited to 'rbutil/rbutilqt/base')
-rw-r--r-- | rbutil/rbutilqt/base/autodetection.cpp | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp index f233f0c3fd..ab2b1bd05c 100644 --- a/rbutil/rbutilqt/base/autodetection.cpp +++ b/rbutil/rbutilqt/base/autodetection.cpp | |||
@@ -238,6 +238,7 @@ QStringList Autodetection::mountpoints() | |||
238 | for(int i=0; i<list.size();i++) | 238 | for(int i=0; i<list.size();i++) |
239 | { | 239 | { |
240 | tempList << list.at(i).absolutePath(); | 240 | tempList << list.at(i).absolutePath(); |
241 | qDebug() << "[Autodetection] Mounted on" << list.at(i).absolutePath(); | ||
241 | } | 242 | } |
242 | 243 | ||
243 | #elif defined(Q_OS_MACX) || defined(Q_OS_OPENBSD) | 244 | #elif defined(Q_OS_MACX) || defined(Q_OS_OPENBSD) |
@@ -247,6 +248,8 @@ QStringList Autodetection::mountpoints() | |||
247 | num = getmntinfo(&mntinf, MNT_WAIT); | 248 | num = getmntinfo(&mntinf, MNT_WAIT); |
248 | while(num--) { | 249 | while(num--) { |
249 | tempList << QString(mntinf->f_mntonname); | 250 | tempList << QString(mntinf->f_mntonname); |
251 | qDebug() << "[Autodetection] Mounted on" << mntinf->f_mntonname | ||
252 | << "is" << mntinf->f_mntfromname << "type" << mntinf->f_fstypename; | ||
250 | mntinf++; | 253 | mntinf++; |
251 | } | 254 | } |
252 | #elif defined(Q_OS_LINUX) | 255 | #elif defined(Q_OS_LINUX) |
@@ -256,8 +259,11 @@ QStringList Autodetection::mountpoints() | |||
256 | return QStringList(""); | 259 | return QStringList(""); |
257 | 260 | ||
258 | struct mntent *ent; | 261 | struct mntent *ent; |
259 | while((ent = getmntent(mn))) | 262 | while((ent = getmntent(mn))) { |
260 | tempList << QString(ent->mnt_dir); | 263 | tempList << QString(ent->mnt_dir); |
264 | qDebug() << "[Autodetection] Mounted on" << ent->mnt_dir | ||
265 | << "is" << ent->mnt_fsname << "type" << ent->mnt_type; | ||
266 | } | ||
261 | endmntent(mn); | 267 | endmntent(mn); |
262 | 268 | ||
263 | #else | 269 | #else |
@@ -284,12 +290,18 @@ QString Autodetection::resolveMountPoint(QString device) | |||
284 | while((ent = getmntent(mn))) { | 290 | while((ent = getmntent(mn))) { |
285 | // Check for valid filesystem. Allow hfs too, as an Ipod might be a | 291 | // Check for valid filesystem. Allow hfs too, as an Ipod might be a |
286 | // MacPod. | 292 | // MacPod. |
287 | if(QString(ent->mnt_fsname) == device | 293 | if(QString(ent->mnt_fsname) == device) { |
288 | && (QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive) | 294 | QString result; |
289 | || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive))) { | 295 | if(QString(ent->mnt_type).contains("vfat", Qt::CaseInsensitive) |
296 | || QString(ent->mnt_type).contains("hfs", Qt::CaseInsensitive)) { | ||
297 | qDebug() << "[Autodetect] resolved mountpoint is:" << ent->mnt_dir; | ||
298 | result = QString(ent->mnt_dir); | ||
299 | } | ||
300 | else { | ||
301 | qDebug() << "[Autodetect] mountpoint is wrong filesystem!"; | ||
302 | } | ||
290 | endmntent(mn); | 303 | endmntent(mn); |
291 | qDebug() << "[Autodetect] resolved mountpoint is:" << ent->mnt_dir; | 304 | return result; |
292 | return QString(ent->mnt_dir); | ||
293 | } | 305 | } |
294 | } | 306 | } |
295 | endmntent(mn); | 307 | endmntent(mn); |
@@ -304,11 +316,16 @@ QString Autodetection::resolveMountPoint(QString device) | |||
304 | while(num--) { | 316 | while(num--) { |
305 | // Check for valid filesystem. Allow hfs too, as an Ipod might be a | 317 | // Check for valid filesystem. Allow hfs too, as an Ipod might be a |
306 | // MacPod. | 318 | // MacPod. |
307 | if(QString(mntinf->f_mntfromname) == device | 319 | if(QString(mntinf->f_mntfromname) == device) { |
308 | && (QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive) | 320 | if(QString(mntinf->f_fstypename).contains("msdos", Qt::CaseInsensitive) |
309 | || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive))) { | 321 | || QString(mntinf->f_fstypename).contains("hfs", Qt::CaseInsensitive)) { |
310 | qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname; | 322 | qDebug() << "[Autodetect] resolved mountpoint is:" << mntinf->f_mntonname; |
311 | return QString(mntinf->f_mntonname); | 323 | return QString(mntinf->f_mntonname); |
324 | } | ||
325 | else { | ||
326 | qDebug() << "[Autodetect] mountpoint is wrong filesystem!"; | ||
327 | return QString(); | ||
328 | } | ||
312 | } | 329 | } |
313 | mntinf++; | 330 | mntinf++; |
314 | } | 331 | } |