mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Update for jart/json.cpp change
This commit is contained in:
@@ -94,8 +94,8 @@ void DsClient::ParseJson() {
|
||||
WPI_DEBUG4(m_logger, "DsClient JSON: {}", m_json);
|
||||
unsigned int ip = 0;
|
||||
try {
|
||||
ip = wpi::util::json::parse(m_json).at("robotIP").get<unsigned int>();
|
||||
} catch (wpi::util::json::exception& e) {
|
||||
ip = wpi::util::json::parse_or_throw(m_json).at("robotIP").get_int();
|
||||
} catch (std::logic_error& e) {
|
||||
WPI_INFO(m_logger, "DsClient JSON error: {}", e.what());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -279,17 +279,17 @@ void MyHttpConnection::ProcessRequest() {
|
||||
bool subdir = entry.is_directory(ec);
|
||||
std::string name = entry.path().filename().string();
|
||||
if (subdir) {
|
||||
dirs.emplace_back(wpi::util::json{{"name", std::move(name)}});
|
||||
dirs.emplace_back(wpi::util::json::object("name", std::move(name)));
|
||||
} else {
|
||||
files.emplace_back(
|
||||
wpi::util::json{{"name", std::move(name)},
|
||||
{"size", subdir ? 0 : entry.file_size(ec)}});
|
||||
wpi::util::json::object("name", std::move(name), "size",
|
||||
subdir ? 0 : entry.file_size(ec)));
|
||||
}
|
||||
}
|
||||
SendResponse(200, "OK", "text/json",
|
||||
wpi::util::json{{"dirs", std::move(dirs)},
|
||||
{"files", std::move(files)}}
|
||||
.dump());
|
||||
wpi::util::json::object("dirs", std::move(dirs), "files",
|
||||
std::move(files))
|
||||
.to_string());
|
||||
} else if (fs::exists(indexpath)) {
|
||||
SendFileResponse(200, "OK", GetMimeType("html"), indexpath,
|
||||
"Content-Disposition: filename=\"index.html\"\r\n");
|
||||
|
||||
Reference in New Issue
Block a user