You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Environment.cpp 679B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "Environment.h"
  2. #include <vector>
  3. #include "Path.h"
  4. #include "../Log.h"
  5. std::string Environment::resourceDir = "";
  6. void Environment::init() {
  7. if (!resourceDir.empty())
  8. return; // already initialized O_o
  9. std::vector<std::string> paths = {
  10. "res"
  11. };
  12. #ifndef _WIN32
  13. // linux or osx
  14. paths.push_back("/usr/share/netrunner/resources");
  15. #else
  16. paths.push_back(""); //TODO: place it somewhere for windows
  17. #endif
  18. for (std::string &path : paths) {
  19. if (Path::directoryExists(path)) {
  20. resourceDir = path;
  21. logInfo() << "Found resource dir at " << path << "!" << std::endl;
  22. break;
  23. }
  24. }
  25. }
  26. std::string Environment::getResourceDir() {
  27. return resourceDir;
  28. }