FSRemove

Syntax

#include <cafe/fs.h>

FSStatus FSRemove(
                FSClient                        *client,
                FSCmdBlock                      *block,
                const char                      *path,
                FSRetFlag                       errHandling
                );
FSStatus FSRemoveAsync(
                FSClient                        *client,
                FSCmdBlock                      *block,
                const char                      *path,
                FSRetFlag                       errHandling,
                const FSAsyncParams             *asyncParams
                );

Parameters

client Pointer to the client buffer.
block Command block.
path File or directory path to be removed. Length must be less than FS_MAX_ARGPATH_SIZE.
errHandling Auto error handling flag. Only indicated errors are returned.
asyncParams (Async API only) Notification parameters for an asynchronous call.

Return Values

Sync API : Return values / Async API: Callback return values

FS_STATUS_OK Successfully completed.
FS_STATUS_CANCELED The command was canceled.
FS_STATUS_EXISTS Any file or directory entries exist in the target (directory only).
FS_STATUS_NOT_FOUND Target not found.
FS_STATUS_NOT_DIR Specified path includes a file entry as directory.
FS_STATUS_ACCESS_ERROR Could not access to specified path.
FS_STATUS_PERMISSION_ERROR The caller does not have correct access permission.
FS_STATUS_ALREADY_OPEN There is one or more open file or directory in the specified path.
FS_STATUS_UNSUPPORTED_CMD Associated file system does not support this function.
FS_STATUS_STORAGE_FULL Data space cannot be allocated to update directory tree.
FS_STATUS_JOURNAL_FULL Journaling space is full and new journaling block cannot be allocated.
FS_STATUS_MEDIA_NOT_READY (Only for manually mounted devices) Media is not present.
FS_STATUS_MEDIA_ERROR (Only for manually mounted devices) Media is in some inaccessible condition.
FS_STATUS_DATA_CORRUPTED (Only for manually mounted devices) The data is corrupted beyond repair. The volume needs format.
FS_STATUS_WRITE_PROTECTED (Only for manually mounted devices) Media is write protected.

Async API: Immediate return values

FS_STATUS_OK Successfully issued request.
FS_STATUS_FATAL_ERROR The argument is invalid.

Description

Removes the file or directory entry designated by path. It cannot be performed, and returns FS_STATUS_ALREADY_OPEN, if path specifies opened entry. It also cannot be performed, and returns FS_STATUS_EXISTS, if any file or directory is included in the target directory.

Both a sync and async style API are provided. To use the async API, set the user callback and parameters in asyncParams. For more information, see FSAsyncParams.

NOTE:
This function does not recursively remove the contents from a directory. To completely remove a directory and all of its content, a recursive function will have to iterate over all elements and delete each file / directory manually. An attempt to remove a non-empty directory will result in a return value of FS_ERROR_NOT_EMPTY.

Do Not Call From

FSRemove

Thread that displays graphics Do not call this function from a thread that displays graphics. This function may block indefinitely in error cases and the application must be able to display appropriate messages.
Thread that handles system messages Do not call this function from a thread that handles system messages. This function may block indefinitely in error cases and the application must be able to handle system events such as shutdown.
Callbacks Do not call this function from any callback function.
Interrupt handler Do not call this function from any interrupt handler.
Exception handler Do not call this function from any exception handler.

FSRemoveAsync

None.

See Also

File/Directory operations
FSMakeDir
FSRename

Revision History

2014/09/16 Added "Thread that displays graphics" and "Thread that handles system messages" to "Do not call from".
2013/06/06 Added FS_STATUS_NOT_DIR and FS_STATUS_ACCESS_ERROR to return values.
2013/05/23 Added FS_STATUS_DATA_CORRUPTED to return values.
2013/05/20 Added FS_STATUS_MEDIA_NOT_READY and FS_STATUS_WRITE_PROTECTED to return values.
2013/05/08 Automated cleanup pass.
2013/01/10 Added "Callback" to "Do not call from".
2012/10/29 Added result "FS_STATUS_EXISTS".
2012/07/20 Readability and correctness cleanup.
2012/02/27 Initial version.
2010/03/30 Fixed type name FSNotificationParams -> FSAsyncParams.


CONFIDENTIAL