summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/utils.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/utils.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/utils.cpp')
-rw-r--r--rbutil/rbutilqt/base/utils.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/utils.cpp b/rbutil/rbutilqt/base/utils.cpp
index 379b642431..2e6b04ecff 100644
--- a/rbutil/rbutilqt/base/utils.cpp
+++ b/rbutil/rbutilqt/base/utils.cpp
@@ -130,3 +130,43 @@ qulonglong filesystemFree(QString path)
return size;
}
+RockboxInfo::RockboxInfo(QString mountpoint)
+{
+ m_path = mountpoint +"/.rockbox/rockbox-info.txt";
+}
+
+bool RockboxInfo::open()
+{
+ QFile file(m_path);
+ if(!file.exists())
+ return false;
+
+ if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
+ return false;
+
+ // read file contents
+ while (!file.atEnd())
+ {
+ QString line = file.readLine();
+
+ if(line.contains("Version:"))
+ {
+ m_version = line.remove("Version:").trimmed();
+ }
+ else if(line.contains("Target: "))
+ {
+ m_target = line.remove("Target: ").trimmed();
+ }
+ else if(line.contains("Features:"))
+ {
+ m_features = line.remove("Features:").trimmed();
+ }
+ else if(line.contains("Target id:"))
+ {
+ m_targetid = line.remove("Target id:").trimmed();
+ }
+ }
+
+ file.close();
+ return true;
+}