ScriptResource.cpp 637 B

1234567891011121314151617181920212223242526272829
  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. {
  9. ScriptResource::~ScriptResource()
  10. {
  11. m_source.destroy(getAllocator());
  12. }
  13. Error ScriptResource::load(const ResourceFilename& filename, Bool async)
  14. {
  15. ResourceFilePtr file;
  16. ANKI_CHECK(openFile(filename, file));
  17. StringAuto src(getAllocator());
  18. ANKI_CHECK(file->readAllText(src));
  19. m_source.create(getAllocator(), src);
  20. return Error::NONE;
  21. }
  22. } // end namespace anki