> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XPersistentLocalStorageGetPathSize

> XPersistentLocalStorageGetPathSize

# XPersistentLocalStorageGetPathSize

Retorna o comprimento, em caracteres, do caminho para o armazenamento local persistente (PLS).

## Sintaxe

```cpp theme={null}
HRESULT XPersistentLocalStorageGetPathSize(  
         size_t* pathSize  
)  
```

### Parâmetros

*pathSize*   \_Out\_\
Tipo: size\_t\*

O comprimento, em caracteres, do caminho do PLS.

### Valor retornado

Tipo: [HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

Retorna **S\_OK** se for bem-sucedida; caso contrário, retorna um código de erro. Para obter uma lista de códigos de erro, consulte [Códigos de erro](/pt-BR/reference/errorcodes).

## Comentários

<Note>Não é seguro chamar esta função em um thread sensível ao tempo. Para obter mais informações, consulte [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads).</Note>

O valor retornado por esta função é usado no parâmetro *pathSize* da função [XPersistentLocalStorageGetPath](/pt-BR/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath) para retornar o caminho do PLS específico do jogo no dispositivo. Para obter mais informações sobre o PLS, consulte [Armazenamento local](/pt-BR/build/console-features/storage/local-storage).

Ao chamar a função **XPersistentLocalStorageGetPath**, aloque para o parâmetro *path* de **XPersistentLocalStorageGetPath** pelo menos a quantidade de caracteres especificada no valor retornado no parâmetro *pathSize* desta função; caso contrário, ocorrerá um erro.

O exemplo a seguir ilustra como usar as funções **XPersistentLocalStorageGetPathSize** e **XPersistentLocalStorageGetPath** para obter o caminho do PLS para o seu jogo.

```cpp theme={null}
// Confirm that all of the features needed to run asynchronous tasks on 
// task queues are available.
LPCSTR Game::CheckPLSPath()
{
    // Confirm the length of the path to the local storage folder.
    LPCSTR returnPath = "";
    size_t pathSize;
    if (SUCCEEDED(XPersistentLocalStorageGetPathSize(&pathSize)))
    {
        char * path = new char[pathSize];
        size_t * pathUsed = new size_t;
        if (path != nullptr)
        {
            // Get the path to the local storage folder.
            if (SUCCEEDED(XPersistentLocalStorageGetPath(pathSize, path, pathUsed))) 
            {
                // Just to be safe, copy the bytes used in the buffer 
                // to a separate string.
                char * actualPath = new char[*pathUsed];
                strncpy(actualPath, path, *pathUsed);
                returnPath = actualPath;
            }
        }
    };

    return returnPath;
}
```

## Requisitos

**Cabeçalho:** XPersistentLocalStorage.h

**Biblioteca:** xgameruntime.lib

**Plataformas com suporte:** Windows, consoles da família XBOX One e consoles XBOX Series

## Documentação conceitual

* [Armazenamento local no console XBOX](/pt-BR/build/console-features/storage/local-storage)
* [Threads sensíveis ao tempo](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## Confira também

[XPersistentLocalStorageGetPath](/pt-BR/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath)\
[XPersistentLocalStorage](/pt-BR/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members)\
[Como usar o novo arquivo MicrosoftGame.config](/pt-BR/build/core-features/common/game-config/MicrosoftGameConfig-toc)


## Related topics

- [XPersistentLocalStorageGetPathSize](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpathsize.md)
- [XPersistentLocalStorageGetPath](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath.md)
