| 1 | #pragma once |
| 2 | |
| 3 | #include <nn/fs/fs_types.h> |
| 4 | |
| 5 | namespace nn::fs { |
| 6 | /* |
| 7 | Open a directory given the path and open mode. |
| 8 | handleOut: Pointer to write the handle into. |
| 9 | path: Path to the directory to open. |
| 10 | openMode: Mode to open the directory with, see nn::fs::OpenDirectoryMode. |
| 11 | */ |
| 12 | Result OpenDirectory(DirectoryHandle* handleOut, const char* path, s32 openMode); |
| 13 | |
| 14 | /* |
| 15 | Closes directory. |
| 16 | handle: Handle of directory to close. |
| 17 | */ |
| 18 | void CloseDirectory(DirectoryHandle handle); |
| 19 | |
| 20 | /* |
| 21 | Read entries for a given opened directory into a provided buffer. |
| 22 | entryCountOut: Pointer to write actual amount of entries read. |
| 23 | entriesOut: Pointer to buffer containing (entryBufferLength) amount of DirectoryEntry |
| 24 | handle: Handle of directory to be opened. |
| 25 | entryBufferLength: How many entries provided in the entriesOut argument. |
| 26 | */ |
| 27 | Result ReadDirectory(s64* entryCountOut, DirectoryEntry* entriesOut, DirectoryHandle handle, |
| 28 | s64 entryBufferLength); |
| 29 | |
| 30 | /* |
| 31 | Creates a directory at given path. |
| 32 | path: Path to path to create. |
| 33 | */ |
| 34 | Result CreateDirectory(const char* path); |
| 35 | |
| 36 | /* |
| 37 | Get the amount of entries in a given opened directory. |
| 38 | entryCountOut: Pointer to write the entry count. |
| 39 | handle: Handle of the directory to count entries. |
| 40 | */ |
| 41 | Result GetDirectoryEntryCount(s64* entryCountOut, DirectoryHandle handle); |
| 42 | |
| 43 | /* |
| 44 | Delete a given directory path and all of it's subdirectories/folders. |
| 45 | path: Path to the directory to delete. |
| 46 | */ |
| 47 | Result DeleteDirectoryRecursively(const char* path); |
| 48 | Result DeleteDirectory(const char* path); |
| 49 | |
| 50 | /* |
| 51 | path: Path to the directory to be cleaned. |
| 52 | */ |
| 53 | Result CleanDirectoryRecursively(const char* path); |
| 54 | |
| 55 | Result RenameDirectory(const char* path, const char* newPath); |
| 56 | |
| 57 | Result GetEntryType(DirectoryEntryType*, const char*); |
| 58 | |
| 59 | } // namespace nn::fs |
| 60 | |