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