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

Function archive_chdir

libctru/source/archive_dev.c:890–914  ·  view source on GitHub ↗

! Change current working directory * * @param[in,out] r newlib reentrancy struct * @param[in] name Path to new working directory * * @returns 0 for success * @returns -1 for error */

Source from the content-addressed store, hash-verified

888 * @returns -1 for error
889 */
890static int
891archive_chdir(struct _reent *r,
892 const char *name)
893{
894 Handle fd;
895 Result rc;
896 FS_Path fs_path;
897 archive_fsdevice *device = r->deviceData;
898
899 fs_path = archive_utf16path(r, name, &device);
900 if(fs_path.data == NULL)
901 return -1;
902
903 rc = FSUSER_OpenDirectory(&fd, device->archive, fs_path);
904 if(R_SUCCEEDED(rc))
905 {
906 FSDIR_Close(fd);
907 strncpy(device->cwd, __ctru_dev_path_buf, PATH_MAX + 1);
908 device->cwd[PATH_MAX] = '\0';
909 return 0;
910 }
911
912 r->_errno = archive_translate_error(rc);
913 return -1;
914}
915
916/*! Rename a file
917 *

Callers

nothing calls this directly

Calls 4

archive_utf16pathFunction · 0.85
FSUSER_OpenDirectoryFunction · 0.85
FSDIR_CloseFunction · 0.85
archive_translate_errorFunction · 0.85

Tested by

no test coverage detected