No Description
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 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "il2cpp-config.h"
  2. #include "os/Environment.h"
  3. #include "os/c-api/Environment-c-api.h"
  4. #include "Allocator.h"
  5. extern "C"
  6. {
  7. char* UnityPalGetOsUserName()
  8. {
  9. return Allocator::CopyToAllocatedStringBuffer(il2cpp::os::Environment::GetOsUserName());
  10. }
  11. char* UnityPalGetEnvironmentVariable(const char* name)
  12. {
  13. std::string name_string = name;
  14. std::string variable = il2cpp::os::Environment::GetEnvironmentVariable(name_string);
  15. if (variable.empty())
  16. return NULL;
  17. return Allocator::CopyToAllocatedStringBuffer(variable);
  18. }
  19. void UnityPalSetEnvironmentVariable(const char* name, const char* value)
  20. {
  21. std::string name_string = name;
  22. std::string value_string = value;
  23. il2cpp::os::Environment::SetEnvironmentVariable(name, value);
  24. }
  25. char* UnityPalGetHomeDirectory()
  26. {
  27. std::string home_directory = il2cpp::os::Environment::GetHomeDirectory();
  28. if (home_directory.empty())
  29. return NULL;
  30. return Allocator::CopyToAllocatedStringBuffer(home_directory);
  31. }
  32. int32_t UnityPalGetProcessorCount()
  33. {
  34. return il2cpp::os::Environment::GetProcessorCount();
  35. }
  36. }