mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-19 18:30:34 +08:00
add: added support with comment-json
This commit is contained in:
parent
2929c9bb2b
commit
a5cf9222ff
@ -1,5 +1,7 @@
|
||||
#include "common/QvHelpers.hpp"
|
||||
|
||||
#include "libs/puresource/src/PureJson.hpp"
|
||||
|
||||
#include <QGraphicsEffect>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QGraphicsScene>
|
||||
@ -42,7 +44,8 @@ namespace Qv2ray::common
|
||||
QTextCodec::ConverterState state;
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
const QString text = codec->toUnicode(byteArray.constData(), byteArray.size(), &state);
|
||||
if (state.invalidChars > 0) {
|
||||
if (state.invalidChars > 0)
|
||||
{
|
||||
LOG(MODULE_FILEIO, "Not a valid UTF-8 sequence: " + source->fileName())
|
||||
return source->readAll();
|
||||
}
|
||||
@ -73,7 +76,7 @@ namespace Qv2ray::common
|
||||
|
||||
QJsonObject JSONFromFile(QFile *sourceFile)
|
||||
{
|
||||
QString json = StringFromFile(sourceFile);
|
||||
QString json = RemoveComment(StringFromFile(sourceFile));
|
||||
return JsonFromString(json);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user