diff --git a/common/settings/json_settings.cpp b/common/settings/json_settings.cpp index 6b7c1967a4..20c8f53189 100644 --- a/common/settings/json_settings.cpp +++ b/common/settings/json_settings.cpp @@ -35,6 +35,7 @@ #include #include #include +#include #include const wxChar* const traceSettings = wxT( "KICAD_SETTINGS" ); @@ -262,12 +263,13 @@ bool JSON_SETTINGS::LoadFromFile( const wxString& aDirectory ) try { - FILE* fp = wxFopen( path.GetFullPath(), wxT( "rt" ) ); + wxFFileInputStream fp( path.GetFullPath(), wxT( "rt" ) ); + wxStdInputStream fstream( fp ); - if( fp ) + if( fp.IsOk() ) { *static_cast( m_internals.get() ) = - nlohmann::json::parse( fp, nullptr, + nlohmann::json::parse( fstream, nullptr, /* allow_exceptions = */ true, /* ignore_comments = */ true );