summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/detect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/base/detect.cpp')
-rw-r--r--rbutil/rbutilqt/base/detect.cpp34
1 files changed, 7 insertions, 27 deletions
diff --git a/rbutil/rbutilqt/base/detect.cpp b/rbutil/rbutilqt/base/detect.cpp
index 1792febc0f..c30a03ba2e 100644
--- a/rbutil/rbutilqt/base/detect.cpp
+++ b/rbutil/rbutilqt/base/detect.cpp
@@ -58,6 +58,7 @@
58#include <sys/mount.h> 58#include <sys/mount.h>
59#endif 59#endif
60 60
61#include "utils.h"
61 62
62/** @brief detect permission of user (only Windows at moment). 63/** @brief detect permission of user (only Windows at moment).
63 * @return enum userlevel. 64 * @return enum userlevel.
@@ -352,23 +353,13 @@ QUrl Detect::systemProxy(void)
352 */ 353 */
353QString Detect::installedVersion(QString mountpoint) 354QString Detect::installedVersion(QString mountpoint)
354{ 355{
355 // read rockbox-info.txt 356 RockboxInfo info(mountpoint);
356 QFile info(mountpoint +"/.rockbox/rockbox-info.txt"); 357 if(!info.open())
357 if(!info.open(QIODevice::ReadOnly))
358 { 358 {
359 return ""; 359 return "";
360 } 360 }
361 361
362 while (!info.atEnd()) { 362 return info.version();
363 QString line = info.readLine();
364
365 if(line.contains("Version:"))
366 {
367 return line.remove("Version:").trimmed();
368 }
369 }
370 info.close();
371 return "";
372} 363}
373 364
374 365
@@ -377,24 +368,13 @@ QString Detect::installedVersion(QString mountpoint)
377 */ 368 */
378QString Detect::installedTarget(QString mountpoint) 369QString Detect::installedTarget(QString mountpoint)
379{ 370{
380 // read rockbox-info.txt 371 RockboxInfo info(mountpoint);
381 QFile info(mountpoint +"/.rockbox/rockbox-info.txt"); 372 if(!info.open())
382 if(!info.open(QIODevice::ReadOnly))
383 { 373 {
384 return ""; 374 return "";
385 } 375 }
386 376
387 while (!info.atEnd()) 377 return info.target();
388 {
389 QString line = info.readLine();
390 if(line.contains("Target:"))
391 {
392 qDebug() << line;
393 return line.remove("Target:").trimmed();
394 }
395 }
396 info.close();
397 return "";
398} 378}
399 379
400 380