SAVEInitSaveDir

Syntax

#include <nn/save.h>

SAVEStatus SAVEInitSaveDir(u8 accountSlotNo);

Parameters

accountSlotNo The user account slot number. To select the slot number of the common save directory, specify ACT_SLOT_NO_COMMON.

Return Values

Synchronous API: Return Value; Asynchronous API: Callback Return Value

SAVE_STATUS_OK Successful.
SAVE_STATUS_NOT_FOUND The specified user account does not exist on this Wii U console.
SAVE_STATUS_DEVICE_FULL (deprecated) The name of this error was changed to SAVE_STATUS_STORAGE_FULL. (SAVE_STATUS_STORAGE_FULL == SAVE_STATUS_DEVICE_FULL)
SAVE_STATUS_STORAGE_FULL Not enough space is available in storage to create the save directory.
SAVE_STATUS_FATAL_ERROR Fatal error occurred. This error is not returned to the application. The application does not need to process this fatal error. Instead, the fatal error message is shown on the TV screen.
A fatal error occurs if the game disc is ejected while this function is copying metadata, such as when the save data icon image is being copied from the game disc to the save meta directory.

Description

Creates the save directory (or BOSS storage) specified by accountSlotNo and mounts it at /vol/save. When you create save directories other than ACT_SLOT_NO_COMMON, if the common directory does not exist (and the common directory has been set to a size greater than 0), the common directory and that account directory are created. (Two directories are created.) If the directory already exists, return SAVE_STATUS_OK without executing any operations on the directory.

SAVEInitSaveDir takes about one second to create save directories and the metadata. The application does not need to call SAVEInitSaveDir every time it starts. If save directories already exist, the application can access those directories without calling SAVEInitSaveDir.

Also, SAVEInitSaveDir flushes the save directories internally. For this reason, directory creation can be established without calling SAVEFlushQuota. If save directories already exist, SAVEInitSaveDir does not flush the save directories.

When calling SAVEInitSaveDir, there are some moments where you cannot access the save directory. Do not access a save directory or save data from other threads while calling SAVEInitSaveDir.

When a USB storage is connected to the Wii U, applications started from the optical disc create save data in the USB storage. However, if the save data already exists in NAND, the disc application creates save data in NAND.

Applications started from NAND create save data in NAND, and applications started from USB storage create save data in the USB storage.

Do Not Call From

Multiple threads This function is not thread-safe.

See Also

File/Directory operations
SAVEOpenDir
SAVERename
SAVERemove

Revision History

2013/12/12 Added a description that SAVEInitSaveDir does not flush the save directories if the save directories already exist.
2013/06/14 Added precautions when calling SAVEInitSaveDir.
2013/05/08 Automated cleanup pass.
2012/09/26 Updated the description.
2012/09/15 Added a description of fatal errors.
2012/09/01 Changed the name of SAVE_STATUS_DEVICE_FULL to SAVE_STATUS_STORAGE_FULL. The reason for this change is that the FS function returns FS_STATUS_STORAGE_FULL, so SAVE_STATUS_STORAGE_FULL is a more appropriate name.
2012/08/31 Added an explanation indicating that applications do not need to handle SAVE_STATUS_FATAL_ERROR.
2012/08/28 Updated the description of the SAVE_STATUS_NOT_FOUND error.
2012/08/20 Added a comment indicating that applications do not need to call this function every time they start.
2012/07/19 Changed the type of the return value.
2012/03/29 Initial version.


CONFIDENTIAL