file access cross-platform compatibility fixes

This commit is contained in:
tmj-fstate
2018-03-29 03:48:21 +02:00
parent 64dea17e6f
commit 6ffced1d90
12 changed files with 40 additions and 30 deletions

View File

@@ -476,9 +476,8 @@ void TEvent::Load(cParser *parser, Math3D::vector3 const &org)
}
else if (token.substr(token.length() - 4, 4) == ".vmd") // na razie tu, może będzie inaczej
{ // animacja z pliku VMD
// TFileStream *fs = new TFileStream( "models\\" + AnsiString( token.c_str() ), fmOpenRead );
{
std::ifstream file( "models\\" + token, std::ios::binary | std::ios::ate ); file.unsetf( std::ios::skipws );
std::ifstream file( szModelPath + token, std::ios::binary | std::ios::ate ); file.unsetf( std::ios::skipws );
auto size = file.tellg(); // ios::ate already positioned us at the end of the file
file.seekg( 0, std::ios::beg ); // rewind the caret afterwards
Params[ 7 ].asInt = size;