Filesystem.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #ifndef ANKI_UTIL_DIRECTORY_H
  6. #define ANKI_UTIL_DIRECTORY_H
  7. #include "anki/util/String.h"
  8. namespace anki {
  9. /// @addtogroup util_file
  10. /// @{
  11. /// Return true if a file exists
  12. Bool fileExists(const CString& filename);
  13. /// Get file extension
  14. /// @param[in] filename The file to open
  15. /// @return nullptr on failure and if the dot is the last character
  16. ANKI_USE_RESULT Error getFileExtension(
  17. const CString& filename, HeapAllocator<U8>& alloc, String& out);
  18. /// Return true if directory exists?
  19. Bool directoryExists(const CString& dir);
  20. /// Equivalent to: rm -rf dir
  21. ANKI_USE_RESULT Error removeDirectory(const CString& dir);
  22. /// Equivalent to: mkdir dir
  23. ANKI_USE_RESULT Error createDirectory(const CString& dir);
  24. /// Get the home directory.
  25. /// Write the home directory to @a buff. The @a buffSize is the size of the
  26. /// @a buff. If the @buffSize is not enough the function will throw
  27. /// an exception.
  28. ANKI_USE_RESULT Error getHomeDirectory(HeapAllocator<U8>& alloc, String& out);
  29. /// @}
  30. } // end namespace anki
  31. #endif