Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use compact format for JSON files #22211

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/base/rss/feed_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void RSS::Private::FeedSerializer::store(const Path &dataFileName, const QList<Q
arr << jsonObj;
}

const nonstd::expected<void, QString> result = Utils::IO::saveToFile(dataFileName, QJsonDocument(arr).toJson());
const nonstd::expected<void, QString> result = Utils::IO::saveToFile(dataFileName, QJsonDocument(arr).toJson(QJsonDocument::Compact));
Chocobo1 marked this conversation as resolved.
Show resolved Hide resolved
if (!result)
{
LogMsg(tr("Failed to save RSS feed in '%1', Reason: %2").arg(dataFileName.toString(), result.error())
Expand Down
4 changes: 2 additions & 2 deletions src/gui/search/searchwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ void SearchWidget::DataStorage::storeSession(const SessionData &sessionData)
};

const Path sessionFilePath = makeDataFilePath(SESSION_FILE_NAME);
const auto saveResult = Utils::IO::saveToFile(sessionFilePath, QJsonDocument(sessionObj).toJson());
const auto saveResult = Utils::IO::saveToFile(sessionFilePath, QJsonDocument(sessionObj).toJson(QJsonDocument::Compact));
Chocobo1 marked this conversation as resolved.
Show resolved Hide resolved
if (!saveResult)
{
LogMsg(tr("Failed to save Search UI state. File: \"%1\". Error: \"%2\"")
Expand Down Expand Up @@ -905,7 +905,7 @@ void SearchWidget::DataStorage::storeTab(const QString &tabID, const QList<Searc
}

const Path filePath = makeDataFilePath(tabID + u".json");
const auto saveResult = Utils::IO::saveToFile(filePath, QJsonDocument(searchResultsArray).toJson());
const auto saveResult = Utils::IO::saveToFile(filePath, QJsonDocument(searchResultsArray).toJson(QJsonDocument::Compact));
glassez marked this conversation as resolved.
Show resolved Hide resolved
if (!saveResult)
{
LogMsg(tr("Failed to save search results. Tab: \"%1\". File: \"%2\". Error: \"%3\"")
Expand Down
Loading