diff options
| author | Amlal <amlalelmahrouss@icloud.com> | 2024-05-23 07:53:50 +0000 |
|---|---|---|
| committer | Amlal <amlalelmahrouss@icloud.com> | 2024-05-23 07:53:50 +0000 |
| commit | f5081a8f9a8537ad5be5d639955cd1d0e68a9e1d (patch) | |
| tree | c9305701aa2d4ee0235c85c67cd6633e5763ec21 /SDK/Library/CoreSystem/Sources/File.c | |
| parent | ca675beb41dba8d7d16c5793b55d1672f38be3b4 (diff) | |
| parent | 06b1a4bb12b4043b606d8bb0d55942d636c6833e (diff) | |
Merged in MHR-23 (pull request #13)
MHR-23
Diffstat (limited to 'SDK/Library/CoreSystem/Sources/File.c')
| -rw-r--r-- | SDK/Library/CoreSystem/Sources/File.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/SDK/Library/CoreSystem/Sources/File.c b/SDK/Library/CoreSystem/Sources/File.c index 6488bccf..7547e7f2 100644 --- a/SDK/Library/CoreSystem/Sources/File.c +++ b/SDK/Library/CoreSystem/Sources/File.c @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright SoftwareLabs + Copyright SoftwareLabs ------------------------------------------- */ @@ -20,24 +20,39 @@ enum FileOp /// @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, +CS_EXTERN_C FSRef CSOpenFile(const CharacterTypeUTF8* path, const CharacterTypeUTF8* rest) { - CA_MUST_PASS(kSharedApplication); - CA_MUST_PASS(path && FsIsValidPath(path) == Yes); - CA_MUST_PASS(rest); + CS_MUST_PASS(kSharedApplication); + CS_MUST_PASS(path && CSIsValidPath(path) == Yes); + CS_MUST_PASS(rest); return kSharedApplication->Invoke(kSharedApplication, kCallOpenFile, path, rest); } /// @brief Closes the file and flushes it to the said file. -/// @param refFs the filesystem reference. +/// @param refCS the filesystem reference. /// @return -CA_EXTERN_C VoidType FsCloseFile(FSRef refFs) +CS_EXTERN_C VoidType CSCloseFile(FSRef refCS) { - CA_MUST_PASS(kSharedApplication); + CS_MUST_PASS(kSharedApplication); - kSharedApplication->Invoke(kSharedApplication, refFs, kFlushFile); - kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refFs); + kSharedApplication->Invoke(kSharedApplication, refCS, kFlushFile); + kSharedApplication->Invoke(kSharedApplication, kCallCloseFile, refCS); } + +/// @brief Check if filesystem path is valid. +/// @param path +/// @return +CS_EXTERN_C BooleanType CSIsValidPath(const CharacterTypeUTF8* path) +{ + CS_MUST_PASS(kSharedApplication); + CS_MUST_PASS(path); + + return kSharedApplication->Invoke(kSharedApplication, kCallFileExists, path) || + kSharedApplication->Invoke(kSharedApplication, kCallDirectoryExists, path) || + kSharedApplication->Invoke(kSharedApplication, kCallSymlinkExists, path) || + kSharedApplication->Invoke(kSharedApplication, kCallDriveExists, path) || + kSharedApplication->Invoke(kSharedApplication, kCallDeviceExists, path); +}
\ No newline at end of file |
