Read mod files to get versions... and stuff.
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
#pragma once
|
||||
#include <QString>
|
||||
#include <QVariant>
|
||||
|
||||
#include <QIODevice>
|
||||
|
||||
#include "libsettings_config.h"
|
||||
|
||||
@ -26,6 +26,7 @@ class LIBSETTINGS_EXPORT INIFile : public QMap<QString, QVariant>
|
||||
public:
|
||||
explicit INIFile();
|
||||
|
||||
bool loadFile(QByteArray file);
|
||||
bool loadFile(QString fileName);
|
||||
bool saveFile(QString fileName);
|
||||
|
||||
|
@ -60,10 +60,16 @@ bool INIFile::saveFile(QString fileName)
|
||||
|
||||
bool INIFile::loadFile(QString fileName)
|
||||
{
|
||||
// TODO Handle errors.
|
||||
QFile file(fileName);
|
||||
file.open(QIODevice::ReadOnly);
|
||||
QTextStream in(&file);
|
||||
if(!file.open(QIODevice::ReadOnly))
|
||||
return false;
|
||||
bool success = loadFile(file.readAll());
|
||||
file.close();
|
||||
return success;
|
||||
}
|
||||
bool INIFile::loadFile( QByteArray file )
|
||||
{
|
||||
QTextStream in(file);
|
||||
in.setCodec("UTF-8");
|
||||
|
||||
QStringList lines = in.readAll().split('\n');
|
||||
|
Reference in New Issue
Block a user