FilePathSeparator.hpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-15
  6. * Changed: 2020-08-16
  7. *
  8. * */
  9. #ifndef FILE_PATH_SEPARATOR_HPP
  10. #define FILE_PATH_SEPARATOR_HPP
  11. #include <string>
  12. namespace ls_std {
  13. class FilePathSeparator {
  14. public:
  15. FilePathSeparator() = default;
  16. ~FilePathSeparator() = default;
  17. static char getLinuxFilePathSeparator() {
  18. return '/';
  19. }
  20. static char getOperatingSystemSpecificSeparator() {
  21. char separator;
  22. #ifdef _WIN32
  23. separator = ls_std::FilePathSeparator::getUnixFilePathSeparator();
  24. #endif
  25. #ifdef unix
  26. separator = ls_std::FilePathSeparator::getLinuxFilePathSeparator();
  27. #endif
  28. #ifdef __APPLE__
  29. separator = ls_std::FilePathSeparator::getLinuxFilePathSeparator();
  30. #endif
  31. return separator;
  32. }
  33. static char getUnixFilePathSeparator() {
  34. return '\\';
  35. }
  36. };
  37. }
  38. #endif