> ## 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

PLS(영구 로컬 스토리지) 경로의 길이(문자 단위)를 반환합니다.

## 구문

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

### 매개 변수

*pathSize*   \_Out\_\
형식: size\_t\*

PLS 경로의 길이(문자 단위)입니다.

### 반환 값

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

성공하면 **S\_OK**를 반환하고, 그렇지 않으면 오류 코드를 반환합니다. 오류 코드 목록은 [오류 코드](/reference/errorcodes)를 참조하세요.

## 설명

<Note>이 함수는 시간에 민감한 스레드에서 호출해서는 안전하지 않습니다. 자세한 내용은 [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)를 참조하세요.</Note>

이 함수의 반환 값은 디바이스의 게임별 PLS 경로를 반환하기 위한 [XPersistentLocalStorageGetPath](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath) 함수의 *pathSize* 매개 변수에 사용됩니다. PLS에 대한 자세한 내용은 [로컬 스토리지](/build/console-features/storage/local-storage)를 참조하세요.

**XPersistentLocalStorageGetPath** 함수를 호출할 때 **XPersistentLocalStorageGetPath**의 *path* 매개 변수에 대해 이 함수의 *pathSize* 매개 변수에서 반환된 값에 지정된 것과 최소한 같은 수의 문자를 할당하세요. 그렇지 않으면 오류가 발생합니다.

다음 예제에서는 **XPersistentLocalStorageGetPathSize** 및 **XPersistentLocalStorageGetPath** 함수를 사용하여 게임의 PLS 경로를 가져오는 방법을 보여줍니다.

```cpp theme={null}
// 작업 큐에서 비동기 작업을 실행하는 데 필요한 모든 기능을 사용할 수 있는지 확인합니다.
LPCSTR Game::CheckPLSPath()
{
    // 로컬 스토리지 폴더 경로의 길이를 확인합니다.
    LPCSTR returnPath = "";
    size_t pathSize;
    if (SUCCEEDED(XPersistentLocalStorageGetPathSize(&pathSize)))
    {
        char * path = new char[pathSize];
        size_t * pathUsed = new size_t;
        if (path != nullptr)
        {
            // 로컬 스토리지 폴더의 경로를 가져옵니다.
            if (SUCCEEDED(XPersistentLocalStorageGetPath(pathSize, path, pathUsed))) 
            {
                // 안전을 위해 버퍼에서 사용된 바이트를 별도의 문자열에 복사합니다.
                char * actualPath = new char[*pathUsed];
                strncpy(actualPath, path, *pathUsed);
                returnPath = actualPath;
            }
        }
    };

    return returnPath;
}
```

## 요구 사항

**헤더:** XPersistentLocalStorage.h

**라이브러리:** xgameruntime.lib

**지원 플랫폼:** Windows, XBOX One 제품군 콘솔 및 XBOX Series 콘솔

## 개념 문서

* [XBOX 콘솔의 로컬 스토리지](/build/console-features/storage/local-storage)
* [시간에 민감한 스레드](https://learn.microsoft.com/gaming/gdk/docs/gdk-dev/console-dev/overviews/threads/time-sensitive-threads)

## 함께 보기

[XPersistentLocalStorageGetPath](/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath)\
[XPersistentLocalStorage](/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members)\
[새 MicrosoftGame.config 파일 사용 방법](/build/core-features/common/game-config/MicrosoftGameConfig-toc)


## Related topics

- [XPersistentLocalStorageGetPath](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetpath.md)
- [XPersistentLocalStorage](/ko/reference/system/xpersistentlocalstorage/xpersistentlocalstorage_members.md)
- [GDK용 Unity C# API 래퍼](/ko/build/gdk-and-engines/unity/unity-api-wrappers.md)
- [XPersistentLocalStorageGetSpaceInfo](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragegetspaceinfo.md)
- [XPersistentLocalStorageMountForPackage](/ko/reference/system/xpersistentlocalstorage/functions/xpersistentlocalstoragemountforpackage.md)
