mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
Formatting chores (#1441)
* format_sources: exclude 3rd party sources * format common project * format leftovers in runner & settings projects * move source formatting-related files according to #939
This commit is contained in:
@@ -5,22 +5,22 @@
|
||||
|
||||
namespace json
|
||||
{
|
||||
std::optional<JsonObject> from_file(std::wstring_view file_name)
|
||||
{
|
||||
try
|
||||
std::optional<JsonObject> from_file(std::wstring_view file_name)
|
||||
{
|
||||
std::wifstream file(file_name.data(), std::ios::binary);
|
||||
using isbi = std::istreambuf_iterator<wchar_t>;
|
||||
return JsonValue::Parse(std::wstring{isbi{file}, isbi{}}).GetObjectW();
|
||||
try
|
||||
{
|
||||
std::wifstream file(file_name.data(), std::ios::binary);
|
||||
using isbi = std::istreambuf_iterator<wchar_t>;
|
||||
return JsonValue::Parse(std::wstring{ isbi{ file }, isbi{} }).GetObjectW();
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
void to_file(std::wstring_view file_name, const JsonObject & obj)
|
||||
{
|
||||
std::wofstream{file_name.data(), std::ios::binary} << obj.Stringify().c_str();
|
||||
}
|
||||
void to_file(std::wstring_view file_name, const JsonObject& obj)
|
||||
{
|
||||
std::wofstream{ file_name.data(), std::ios::binary } << obj.Stringify().c_str();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user