FilePathSeparator.hpp 939 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2020-08-15
  6. * Changed: 2020-11-06
  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 get() {
  18. char separator;
  19. #ifdef _WIN32
  20. separator = ls_std::FilePathSeparator::getWindowsFilePathSeparator();
  21. #endif
  22. #if defined(unix) || defined(__APPLE__)
  23. separator = ls_std::FilePathSeparator::getUnixFilePathSeparator();
  24. #endif
  25. return separator;
  26. }
  27. static char getUnixFilePathSeparator() {
  28. return '/';
  29. }
  30. static char getWindowsFilePathSeparator() {
  31. return '\\';
  32. }
  33. };
  34. }
  35. #endif