fileResolver.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. class fs
  11. {
  12. public:
  13. class fileResolver
  14. {
  15. public:
  16. fileResolver ();
  17. fileResolver (std::vector<irr::io::path> environment);
  18. void appendEnvironment (irr::io::path path);
  19. void removeEnvironment (irr::io::path path);
  20. void changeWorkingDirectory (irr::io::path newpath);
  21. irr::io::path getWorkingDirectory ();
  22. fileResolver clone ();
  23. irr::io::path resolve (irr::io::path name);
  24. irr::io::path resolveOnWorkingDirectory (irr::io::path name);
  25. irr::io::path resolve (json name);
  26. irr::io::path resolveOnWorkingDirectory (json name);
  27. irr::io::path resolve (const char* name);
  28. irr::io::path resolveOnWorkingDirectory (const char* name);
  29. protected:
  30. void prependEnvironment (irr::io::path path);
  31. private:
  32. std::vector<irr::io::path> m_environment;
  33. };
  34. static fileResolver resolver;
  35. };
  36. }
  37. #endif //WALLENGINE_RESOLVER_H