summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/autodetection.cpp
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2009-03-21 16:30:40 +0000
committerDominik Wenger <domonoky@googlemail.com>2009-03-21 16:30:40 +0000
commit6c73482d0058804979c511616ad95d643a5143c2 (patch)
tree6cb432509a360926ce8ccd4c21e31c3f2919ba9d /rbutil/rbutilqt/base/autodetection.cpp
parent7aaffa51d6bd36e7be9d6895d9310f0d8fea8dfd (diff)
downloadrockbox-6c73482d0058804979c511616ad95d643a5143c2.tar.gz
rockbox-6c73482d0058804979c511616ad95d643a5143c2.tar.bz2
rockbox-6c73482d0058804979c511616ad95d643a5143c2.zip
rbutil: create a RockboxInfo class so all rockbox-info.txt handling is in one place.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20429 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/autodetection.cpp')
-rw-r--r--rbutil/rbutilqt/base/autodetection.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/rbutil/rbutilqt/base/autodetection.cpp b/rbutil/rbutilqt/base/autodetection.cpp
index 3e3c63ec32..aa74419ce0 100644
--- a/rbutil/rbutilqt/base/autodetection.cpp
+++ b/rbutil/rbutilqt/base/autodetection.cpp
@@ -90,21 +90,18 @@ bool Autodetection::detect()
}
// check rockbox-info.txt afterwards.
- QFile file(mounts.at(i) + "/.rockbox/rockbox-info.txt");
- if(file.exists())
+ RockboxInfo info(mounts.at(i));
+ if(info.open())
{
- file.open(QIODevice::ReadOnly | QIODevice::Text);
- QString line = file.readLine();
- if(line.startsWith("Target: "))
+ if(m_device.isEmpty())
{
- line.remove("Target: ");
- if(m_device.isEmpty())
- m_device = line.trimmed(); // trim whitespaces
- m_mountpoint = mounts.at(i);
- qDebug() << "rockbox-info.txt detected:" << m_device << m_mountpoint;
- return true;
- }
+ m_device = info.target();
+ }
+ m_mountpoint = mounts.at(i);
+ qDebug() << "rockbox-info.txt detected:" << m_device << m_mountpoint;
+ return true;
}
+
// check for some specific files in root folder
QDir root(mounts.at(i));
QStringList rootentries = root.entryList(QDir::Files);