CmPath.h 612 B

1234567891011121314151617181920212223242526272829303132
  1. #pragma once
  2. #include "CmPrerequisitesUtil.h"
  3. #include <boost/filesystem.hpp>
  4. namespace CamelotEngine
  5. {
  6. /**
  7. * @brief Various utility methods for handling file paths.
  8. */
  9. class Path
  10. {
  11. public:
  12. static String getExtension(const String& path)
  13. {
  14. return boost::filesystem::extension(path);
  15. }
  16. static bool hasExtension(const String& path, const String& extension)
  17. {
  18. return getExtension(path) == extension;
  19. }
  20. static String combine(const String& base, const String& name)
  21. {
  22. if (base.empty())
  23. return name;
  24. else
  25. return base + '/' + name;
  26. }
  27. };
  28. }