summaryrefslogtreecommitdiffhomepage
path: root/SDK/Developer/CoreSystem/Headers/File.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-05-08 12:32:41 +0200
commit09dd11ddf800898c00ecb04a65fb5cd10fb481fa (patch)
treeeda0b4e23d6a71da7de3a78f0bb76ec3201dd2f9 /SDK/Developer/CoreSystem/Headers/File.h
parentca83108fd138cc0398f900e6a6c0a53ad51aee31 (diff)
MHR-23: :boom: changes, reworked project tree.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'SDK/Developer/CoreSystem/Headers/File.h')
-rw-r--r--SDK/Developer/CoreSystem/Headers/File.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/SDK/Developer/CoreSystem/Headers/File.h b/SDK/Developer/CoreSystem/Headers/File.h
new file mode 100644
index 00000000..6b0bb29b
--- /dev/null
+++ b/SDK/Developer/CoreSystem/Headers/File.h
@@ -0,0 +1,52 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once
+
+#include <Headers/Defines.h>
+
+/// @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.
+CA_EXTERN_C FSRef FsOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* r);
+
+/// @brief Closes the file and flushes it to the said file.
+/// @param refFs the filesystem reference.
+/// @return
+CA_EXTERN_C VoidType FsCloseFile(FSRef refFs);
+
+#define kMaxForkNameLength 256 /* long fork names. */
+
+/// @brief A fork information header.
+typedef struct _Fork
+{
+ PtrVoidType forkData;
+ SizeType forkSize;
+ Int32Type forkFlags;
+ Int32Type forkKind;
+ CharacterTypeUTF8 forkName[kMaxForkNameLength];
+} ForkType;
+
+typedef ForkType* FSForkRef;
+
+/// @brief Gets the fork inside a file.
+/// @param refFs the filesystem ref
+/// @param forkName the fork's name
+/// @return the fork data.
+CA_EXTERN_C FSForkRef FsGetFork(FSRef refFs, const CharacterTypeUTF8* forkName);
+
+/// @brief Check if the filesystem path is valid.
+/// @return if not return false, or true.
+CA_EXTERN_C BooleanType FsIsValidPath(const CharacterTypeUTF8* path);
+
+/// @note not only limited to, there is code forks, icon forks...
+#define FsGetDataFork(refFs) FsGetFork(refFs, "data")
+#define FsGetRsrcFork(refFs) FsGetFork(refFs, "rsrc")