XPersistentLocalStorageGetPathSize
영구 로컬 저장소(PLS)에 대한 경로의 길이(문자 수)를 반환합니다.
구문
HRESULT XPersistentLocalStorageGetPathSize(
size_t* pathSize
)
매개 변수
pathSize _Out_
형식: size_t*
PLS 경로의 길이(문자 수)입니다.
반환 값
형식: HRESULT
성공한 경우 S_OK를 반환하고, 그렇지 않으면 오류 코드를 반환합니다. 오류 코드 목록은 오류 코드를 참조하세요.
설명
참고 항목
이 함수는 시간에 민감한 스레드에서 호출하는 것이 안전하지 않습니다. 자세한 내용은 시간에 민감한 스레드를 참조하세요.
이 함수의 반환 값은 XPersistentLocalStorageGetPath 함수의 pathSize 매개 변수에 의해 장치에서 게임별 PLS 경로를 반환하는 데 사용됩니다. PLS에 대한 자세한 내용은, 로컬 저장소를 참조하세요.
XPersistentLocalStorageGetPath 함수를 호출할 때 XPersistentLocalStorageGetPath의 path 매개 변수에 이 함수의 pathSize 매개 변수에 반환된 값에 지정된 수만큼 문자를 할당하세요. 그렇게 하지 않으면 오류가 발생합니다.
다음 예제에서는 XPersistentLocalStorageGetPathSize 및 XPersistentLocalStorageGetPath함수를 사용하여 게임의 PLS 경로를 가져오는 방법을 보여줍니다.
// 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;
}
요구 사항
헤더: XPersistentLocalStorage.h
라이브러리: xgameruntime.lib
지원되는 플랫폼: Windows, Xbox One 패밀리 콘솔 및 Xbox Series 콘솔
참고 항목
XPersistentLocalStorageGetPath
XPersistentLocalStorage
새로운 MicrosoftGame.config 파일을 사용하는 방법