Use utf8. Partially reverts e35174d64b

This commit is contained in:
Alex Shvartzkop 2023-11-09 02:12:10 +03:00
parent e35174d64b
commit b596568ce4
3 changed files with 14 additions and 3 deletions

View File

@ -36,9 +36,20 @@ public:
bool CheckFileHeader( const std::filesystem::path& aPath ) const;
bool CheckFileHeader( const std::string& aPath ) const
{
return CheckFileHeader( std::filesystem::path( aPath ) );
};
CADSTAR_PARTS_LIB_MODEL ReadContent( const std::string& aSource ) const;
CADSTAR_PARTS_LIB_MODEL ReadFile( const std::filesystem::path& aPath ) const;
CADSTAR_PARTS_LIB_MODEL ReadFile( const std::string& aPath ) const
{
return ReadFile( std::filesystem::path( aPath ) );
};
};
#endif //CADSTAR_PARTS_LIB_PARSER_H

View File

@ -67,12 +67,12 @@ std::vector<LIB_SYMBOL*> CADSTAR_SCH_ARCHIVE_LOADER::LoadPartsLib( const wxStrin
CADSTAR_PARTS_LIB_PARSER p;
if( !p.CheckFileHeader( aFilename.fn_str() ) )
if( !p.CheckFileHeader( aFilename.utf8_string() ) )
THROW_IO_ERROR(
_( "The selected file does not appear to be a CADSTAR parts Library file" ) );
// TODO: we could add progress reporting for reading .lib
CADSTAR_PARTS_LIB_MODEL csLib = p.ReadFile( aFilename.fn_str() );
CADSTAR_PARTS_LIB_MODEL csLib = p.ReadFile( aFilename.utf8_string() );
if( m_progressReporter )
{

View File

@ -57,7 +57,7 @@ bool CADSTAR_SCH_ARCHIVE_PLUGIN::CanReadLibrary( const wxString& aFileName ) con
try
{
CADSTAR_PARTS_LIB_PARSER p;
return p.CheckFileHeader( aFileName.fn_str() );
return p.CheckFileHeader( aFileName.utf8_string() );
}
catch( const std::runtime_error& )
{