fileResolver.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef WALLENGINE_RESOLVER_H
  2. #define WALLENGINE_RESOLVER_H
  3. #include <string>
  4. #include <vector>
  5. #include <irrlicht/path.h>
  6. #include <nlohmann/json.hpp>
  7. namespace wp
  8. {
  9. using json = nlohmann::json;
  10. namespace fs
  11. {
  12. class fileResolver
  13. {
  14. public:
  15. fileResolver ();
  16. fileResolver (std::vector<irr::io::path> environment);
  17. void appendEnvironment (irr::io::path path);
  18. void removeEnvironment (irr::io::path path);
  19. void changeWorkingDirectory (irr::io::path newpath);
  20. irr::io::path getWorkingDirectory ();
  21. fileResolver clone ();
  22. irr::io::path resolve (irr::io::path name);
  23. irr::io::path resolveOnWorkingDirectory (irr::io::path name);
  24. irr::io::path resolve (json name);
  25. irr::io::path resolveOnWorkingDirectory (json name);
  26. irr::io::path resolve (const char* name);
  27. irr::io::path resolveOnWorkingDirectory (const char* name);
  28. protected:
  29. void prependEnvironment (irr::io::path path);
  30. private:
  31. std::vector<irr::io::path> m_environment;
  32. };
  33. extern fileResolver resolver;
  34. };
  35. }
  36. #endif //WALLENGINE_RESOLVER_H