mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-14 07:32:35 -05:00
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
This commit is contained in:
parent
7aaffa51d6
commit
6c73482d00
5 changed files with 83 additions and 62 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue