FilePathSeparator.hpp 942 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-08-15
  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. return separator;
  29. }
  30. static char getUnixFilePathSeparator() {
  31. return '\\';
  32. }
  33. };
  34. }
  35. #endif