ScriptResource.cpp 647 B

12345678910111213141516171819202122232425262728
  1. // Copyright (C) 2009-2022, 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(getMemoryPool());
  11. }
  12. Error ScriptResource::load(const ResourceFilename& filename, [[maybe_unused]] Bool async)
  13. {
  14. ResourceFilePtr file;
  15. ANKI_CHECK(openFile(filename, file));
  16. StringRaii src(&getMemoryPool());
  17. ANKI_CHECK(file->readAllText(src));
  18. m_source = std::move(src);
  19. return Error::kNone;
  20. }
  21. } // end namespace anki