summaryrefslogtreecommitdiffhomepage
path: root/Public/Developer/System.Core/Headers/File.h
blob: 13bc7a00c62e205c9f49d9d30fdd8656ef0bc880 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* -------------------------------------------

    Copyright Mahrouss Logic

------------------------------------------- */

#pragma once

#include <System.Core/Headers/Defines.h>

/// @brief Filesystem wrapper.

typedef QWordTyp FSRef;

/// @brief Opens a new file.
/// @param path where to find it.
/// @param r the restrict (rw, rwe, r+, w+, r, w)
/// @return 
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);

typedef QWordTyp FSForkRef;

/// @brief A fork information header.
typedef struct _Fork {
    PtrVoidType forkData;
    SizeType forkSize;
    Int32Type forkFlags;
    Int32Type forkKind;
    CharacterTypeUTF8 forkName[256];
} ForkType;

/// @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);

#define FsGetDataFork(refFs) FsGetFork(refFs, "data")
#define FsGetRsrcFork(refFs) FsGetFork(refFs, "rsrc")