diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-06-06 10:27:55 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-06-06 10:27:55 +0000 |
| commit | 4e75e05a20ddd0dbca982e8f3bc2ea8043ed3a3f (patch) | |
| tree | 95409c0e32b644578b94a5c230417da684d79dc9 /SDK/Libraries/CoreSystem/Headers/File.h | |
| parent | f5081a8f9a8537ad5be5d639955cd1d0e68a9e1d (diff) | |
| parent | 9994b8f3f88131f41be1061fb0947177e66dc7b0 (diff) | |
Merged in MHR-23 (pull request #14)
Draft: MHR-23
Diffstat (limited to 'SDK/Libraries/CoreSystem/Headers/File.h')
| -rw-r--r-- | SDK/Libraries/CoreSystem/Headers/File.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/SDK/Libraries/CoreSystem/Headers/File.h b/SDK/Libraries/CoreSystem/Headers/File.h new file mode 100644 index 00000000..cfd9ee30 --- /dev/null +++ b/SDK/Libraries/CoreSystem/Headers/File.h @@ -0,0 +1,57 @@ +/* ------------------------------------------- + + Copyright SoftwareLabs + +------------------------------------------- */ + +#pragma once + +#include <Headers/Defines.h> + +#define kMaxForkNameLength (256U) /* long fork names. */ + +struct _Fork; + +/// @brief Filesystem wrapper. + +typedef QWordType FSRef; + +/// @brief Opens a new file. +/// @param path where to find it. +/// @param rest the restrict (rw, rwe, r+, w+, r, w) +/// @return FSRef the file. +CS_EXTERN_C FSRef CSOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r); + +/// @brief Closes the file and flushes it to the said file. +/// @param refCS the filesystem reference. +/// @return +CS_EXTERN_C VoidType CSCloseFile(FSRef refCS); + +/// @brief A fork information header. +typedef struct _Fork +{ + Int32Type forkFlags; + Int32Type forkKind; + CharacterTypeUTF8 forkName[kMaxForkNameLength]; + SizeType forkSize; + CharacterTypeUTF8 forkData[]; +} ForkType, ForkTypePtr; + +typedef ForkType* FSForkRef; + +/// @brief Gets the fork inside a file. +/// @param refCS the filesystem ref +/// @param forkName the fork's name +/// @return the fork data. +CS_EXTERN_C FSForkRef CSGetFork(FSRef refCS, const CharacterTypeUTF8* forkName); + +/// @brief Check if the filesystem path is valid. +/// @return if not return false, or true. +CS_EXTERN_C BooleanType CSIsValidPath(const CharacterTypeUTF8* path); + +/// @brief Flush file +/// @param refCS the file reference. +/// @return +CS_EXTERN_C VoidType CSFlushFile(FSRef refCS); + +/// END OF FILE |
