Support for wchar_t Windows filenames in JSON settings.
This commit is contained in:
parent
23e834fdb5
commit
61c817377f
|
@ -188,8 +188,8 @@ bool JSON_SETTINGS::LoadFromFile( const std::string& aDirectory )
|
|||
{
|
||||
try
|
||||
{
|
||||
std::ifstream in( path.GetFullPath().ToUTF8() );
|
||||
in >> *this;
|
||||
FILE* fp = wxFopen( path.GetFullPath(), wxT( "rt" ) );
|
||||
*static_cast<nlohmann::json*>( this ) = nlohmann::json::parse( fp );
|
||||
|
||||
// If parse succeeds, check if schema migration is required
|
||||
int filever = -1;
|
||||
|
@ -352,12 +352,12 @@ bool JSON_SETTINGS::SaveToFile( const std::string& aDirectory, bool aForce )
|
|||
|
||||
try
|
||||
{
|
||||
std::ofstream file( path.GetFullPath().ToUTF8() );
|
||||
file << std::setw( 2 ) << *this << std::endl;
|
||||
}
|
||||
catch( const std::exception& e )
|
||||
wxFile file( path.GetFullPath(), wxFile::write );
|
||||
|
||||
if( !file.IsOpened() || !file.Write( wxString( dump( 0 ).c_str(), wxConvUTF8 ) ) )
|
||||
{
|
||||
wxLogTrace( traceSettings, "Warning: could not save %s: %s", GetFullFilename(), e.what() );
|
||||
wxLogTrace( traceSettings, "Warning: could not save %s", GetFullFilename() );
|
||||
}
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue