MCPcopy Create free account
hub / github.com/devkitPro/libctru / archive_mkdir

Function archive_mkdir

libctru/source/archive_dev.c:999–1032  ·  view source on GitHub ↗

! Create a directory * * @param[in,out] r newlib reentrancy struct * @param[in] path Path of directory to create * @param[in] mode Permissions of created directory * * @returns 0 for success * @returns -1 for error */

Source from the content-addressed store, hash-verified

997 * @returns -1 for error
998 */
999static int
1000archive_mkdir(struct _reent *r,
1001 const char *path,
1002 int mode)
1003{
1004 Result rc;
1005 FS_Path fs_path;
1006 archive_fsdevice *device = r->deviceData;
1007
1008 /* treat extdata as read-only */
1009 if(device->is_extdata)
1010 {
1011 r->_errno = ENOTSUP;
1012 return -1;
1013 }
1014
1015 fs_path = archive_utf16path(r, path, &device);
1016 if(fs_path.data == NULL)
1017 return -1;
1018
1019 /* TODO: Use mode to set directory attributes. */
1020
1021 rc = FSUSER_CreateDirectory(device->archive, fs_path, 0);
1022 if(rc == 0xC82044BE)
1023 {
1024 r->_errno = EEXIST;
1025 return -1;
1026 }
1027 else if(R_SUCCEEDED(rc))
1028 return 0;
1029
1030 r->_errno = archive_translate_error(rc);
1031 return -1;
1032}
1033
1034/*! Open a directory
1035 *

Callers

nothing calls this directly

Calls 3

archive_utf16pathFunction · 0.85
FSUSER_CreateDirectoryFunction · 0.85
archive_translate_errorFunction · 0.85

Tested by

no test coverage detected