26#include <wx/wfstream.h>
27#include <wx/txtstrm.h>
33 bool aIgnoreWhitespace )
35 wxFFileInputStream input( aFilePath );
37 if( input.IsOk() && !input.Eof() )
40 wxTextInputStream
text( input );
41 wxString line =
text.ReadLine();
43 if( aIgnoreWhitespace )
45 while( !input.Eof() && line.IsEmpty() )
46 line =
text.ReadLine().Trim(
false );
49 if( line.StartsWith( aPrefix ) )
59 wxFFileInputStream input( aFilePath );
61 if( input.IsOk() && !input.Eof() )
63 if(
static_cast<size_t>( input.GetLength() ) < aHeader.size() )
66 std::vector<uint8_t> parsedHeader( aHeader.size() );
68 if( !input.ReadAll( parsedHeader.data(), parsedHeader.size() ) )
71 return parsedHeader == aHeader;
bool fileStartsWithPrefix(const wxString &aFilePath, const wxString &aPrefix, bool aIgnoreWhitespace)
Check if a file starts with a defined string.
bool fileStartsWithBinaryHeader(const wxString &aFilePath, const std::vector< uint8_t > &aHeader)
Check if a file starts with a defined binary header.