Skip to main content

XPersistentLocalStorageGetPath

Returns the game-specific path to the persistent local storage (PLS) on the device.

Syntax

Parameters

pathSize   _In_
Type: size_t
The number of characters in the buffer provided for the PLS path. To obtain this value, call XPersistentLocalStorageGetPathSize. path   _Out_writes_to_(pathSize,pathUsed)
Type: char
The PLS path to which your game can write data. pathUsed   _Out_opt_
Type: size_t*
The number of characters written to the supplied buffer.

Return value

Type: HRESULT Returns S_OK if successful; otherwise, returns an error code. For a list of error codes, see Error Codes. If the function fails because pathSize is less than the length of the PLS path, the return value is set to E_FAIL for XBOX devices and to HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) for PC devices.

Remarks

This function isn’t safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.
Games might require PLS for tasks such as staging space, in-game DLC, and on-demand generation of content. Although the space is retained across activations of the game, it can also be deleted by users. For more information about PLS, see Local Storage PLS is accessed and managed according to the device’s family. For XBOX devices, we provide access to a folder mounted to the root of a drive. The amount of storage space provisioned for that folder is specified in the MicrosoftGame.config file for your game. The provisioned space is available and always present during a launch of your game. To free up space, users may delete the provisioned space without uninstalling the game, when the game is not running; however, when the game is running, the availability of storage is guaranteed. To get this space provisioned for XBOX devices, you must have a corresponding entry in your MicrosoftGame.config file. For PC devices, we provide access to a local storage folder’s location on the PC, but space is not specifically provisioned for your game. Users may delete that space even while the game is running. The availability of storage is not guaranteed, and an entry in your MicrosoftGame.config file is not required to claim storage space. You must first confirm that the space available in the local storage folder is sufficient for your game’s purposes. Before calling this function to retrieve the PLS path, call the XPersistentLocalStorageGetPathSize function to get the number of characters in the PLS path, then provide that value in the pathSize parameter and allocate at least as many characters for the path parameter. An error will occur if fewer characters are specified in pathSize than are contained in the PLS path. The following example illustrates how to use the XPersistentLocalStorageGetPathSize and XPersistentLocalStorageGetPath functions to get the PLS path for your game.

Requirements

Header: XPersistentLocalStorage.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

Conceptual documentation

See also

XPersistentLocalStorageGetPathSize
XPersistentLocalStorage
How to use the new MicrosoftGame.config file
Last modified on August 20, 2026