Filesystem.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef ANKI_UTIL_FILESYSTEM_H
  2. #define ANKI_UTIL_FILESYSTEM_H
  3. #include "anki/util/StringList.h"
  4. #include <string>
  5. namespace anki {
  6. /// @addtogroup util
  7. /// @{
  8. /// @addtogroup filesystem
  9. /// @{
  10. /// Get file extension
  11. /// @param[in] filename The file to open
  12. /// @return nullptr on failure and if the dot is the last character
  13. extern const char* getFileExtension(const char* filename);
  14. /// Open a text file and return its contents into a string
  15. extern std::string readFile(const char* filename);
  16. /// Open a text file and return its lines into a string vector
  17. extern StringList readFileLines(const char* filename);
  18. /// File exists?
  19. extern bool fileExists(const char* filename);
  20. /// Directory exists?
  21. extern bool directoryExists(const char* filename);
  22. /// rm -rf
  23. extern void removeDirectory(const char* dir);
  24. /// mkdir
  25. extern void createDirectory(const char* dir);
  26. /// Convert a POSIX path to a platform native path. It actually replaces /
  27. /// with \ in windows
  28. extern void toNativePath(const char* path);
  29. /// @}
  30. /// @}
  31. } // end namespace anki
  32. #endif