summaryrefslogtreecommitdiffhomepage
path: root/SDK/Libraries/CoreSystem/Headers/File.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-05-27 20:45:46 +0200
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-05-27 20:45:46 +0200
commit9db58da40cfcb6643412bfae25aefc0cd1077f9d (patch)
treec6664fc649968ca1be7ddc59dfe3e9a7dd0f3ebc /SDK/Libraries/CoreSystem/Headers/File.h
parentce84bea215424ff36a2c18cab67835edfa8f71b5 (diff)
MHR-23: Improve project structure, make it better.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'SDK/Libraries/CoreSystem/Headers/File.h')
-rw-r--r--SDK/Libraries/CoreSystem/Headers/File.h52
1 files changed, 52 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..0013b074
--- /dev/null
+++ b/SDK/Libraries/CoreSystem/Headers/File.h
@@ -0,0 +1,52 @@
+/* -------------------------------------------
+
+ 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);
+
+/// END OF FILE