Common01/Source/Common/FileSystem/FileSystem.cpp
const FileSystem::TFileData FileSystem::SyncReadFile(const std::filesystem::path& absolutePath)
{
   std::ifstream inFile(absolutePath, std::ios::in | std::ios::binary | std::ios::ate);
   
   if ((!inFile) || (!inFile.good()))
   {
      throw std::exception("SyncReadFile");
   }

   std::streampos len = inFile.tellg();
   if (!inFile)
   {
      throw std::exception("SyncReadFile");
   }

   auto pBlob = std::make_shared< std::vector< uint8_t > >();
   pBlob->resize(size_t(len));

   inFile.seekg(0, std::ios::beg);
   if (!inFile)
   {
      throw std::exception("SyncReadFile");
   }

   inFile.read(reinterpret_cast<char*>(pBlob->data()), len);
   if (!inFile)
   {
      throw std::exception("SyncReadFile");
   }

   inFile.close();

   return pBlob;
}
// based on code Copyright (c) Microsoft Corporation. All rights reserved. ReadData.h
based on code Copyright (c) Microsoft Corporation. All rights reserved.
based on code Copyright ( c ) Microsoft Corporation . All rights reserved .
const FileSystem::TFileData FileSystem::SyncReadFile(const std::filesystem::path& absolutePath)
{
   std::ifstream inFile(absolutePath, std::ios::in | std::ios::binary | std::ios::ate);
   if ((!inFile) || (!inFile.good()))
   {
      throw std::exception("SyncReadFile");
   }
   std::streampos len = inFile.tellg();
   if (!inFile)
   {
      throw std::exception("SyncReadFile");
   }
   auto pBlob = std::make_shared< std::vector< uint8_t > >();
   pBlob->resize(size_t(len));
   inFile.seekg(0, std::ios::beg);
   if (!inFile)
   {
      throw std::exception("SyncReadFile");
   }
   inFile.read(reinterpret_cast<char*>(pBlob->data()), len);
   if (!inFile)
   {
      throw std::exception("SyncReadFile");
   }
   inFile.close();
   return pBlob;
}
const FileSystem :: TFileData FileSystem :: SyncReadFile ( const std :: filesystem :: path & absolutePath ) { std :: ifstream inFile ( absolutePath , std :: ios :: in | std :: ios :: binary | std :: ios :: ate ) ; if ( ( ! inFile ) || ( ! inFile . good ( ) ) ) { throw std :: exception ( " " ) ; } std :: streampos len = inFile . tellg ( ) ; if ( ! inFile ) { throw std :: exception ( " " ) ; } auto pBlob = std :: make_shared < std :: vector < uint8_t > > ( ) ; pBlob -> resize ( size_t ( len ) ) ; inFile . seekg ( 0 , std :: ios :: beg ) ; if ( ! inFile ) { throw std :: exception ( " " ) ; } inFile . read ( reinterpret_cast < char * > ( pBlob -> data ( ) ) , len ) ; if ( ! inFile ) { throw std :: exception ( " " ) ; } inFile . close ( ) ; return pBlob ; }
based on code Copyright (c) Microsoft Corporation.
based on code Copyright ( c ) Microsoft Corporation .