ScriptResource.cpp 637 B

12345678910111213141516171819202122232425262728
  1. // Copyright (C) 2009-2021, Panagiotis Christopoulos Charitos and contributors.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #include <AnKi/Resource/ScriptResource.h>
  6. #include <AnKi/Util/File.h>
  7. namespace anki {
  8. ScriptResource::~ScriptResource()
  9. {
  10. m_source.destroy(getAllocator());
  11. }
  12. Error ScriptResource::load(const ResourceFilename& filename, Bool async)
  13. {
  14. ResourceFilePtr file;
  15. ANKI_CHECK(openFile(filename, file));
  16. StringAuto src(getAllocator());
  17. ANKI_CHECK(file->readAllText(src));
  18. m_source.create(getAllocator(), src);
  19. return Error::NONE;
  20. }
  21. } // end namespace anki