1.2.7.4.32 SYS_FS_CurrentWorkingDirectoryGet Function
1.2.7.4.32 C
SYS_FS_RESULT SYS_FS_CurrentWorkingDirectoryGet
(
char *buff,
uint32_t len
);
1.2.7.4.32 Summary
Gets the current working directory.
1.2.7.4.32 Description
This function gets the current working directory path along with the working drive.
1.2.7.4.32 Precondition
At least one disk must be mounted.
1.2.7.4.32 Parameters
| Parameters | Description |
|---|---|
| buff | Pointer to a buffer which will contain the name of the current working directory and drive, once the function completes |
| len | Size of the buffer |
1.2.7.4.32 Returns
SYS_FS_RES_SUCCESS - Get current working directory operation was successful.
SYS_FS_RES_FAILURE - Get current working directory operation was unsuccessful. The reason for the failure can be retrieved with SYS_FS_Error.
1.2.7.4.32 Example
SYS_FS_RESULT res; char buffer[16]; switch(appState) { case TRY_MOUNT: { if(SYS_FS_Mount("/dev/mmcblka1", "/mnt/myDrive", FAT, 0, NULL) != SYS_FS_RES_SUCCESS) { // Failure, try mounting again } else { // Mount was successful. Create a directory. appState = CREATE_DIR; } break; } case CREATE_DIR: { res = SYS_FS_DirectoryMake("Dir1"); if(res == SYS_FS_RES_FAILURE) { // Directory creation failed appState = ERROR; } else { // Directory creation was successful. Change to the new // directory. appState = CHANGE_DIR; } break; } case CHANGE_DIR: { res = SYS_FS_DirectoryChange("Dir1"); if(res == SYS_FS_RES_FAILURE) { // Directory change failed appState = ERROR; } else { // Directory change was successful. Get current working // directory appState = GET_CWD; } break; } case GET_CWD: { res = SYS_FS_CurrentWorkingDirectoryGet(buffer, 15); if(res == SYS_FS_RES_FAILURE) { // Get current directory operation failed appState = ERROR; } break; } }
1.2.7.4.32 Remarks
None.
