GetAppInstallDir accuracy improvements.

This commit is contained in:
Mr_Goldberg 2019-12-12 14:11:05 -05:00
parent 4bb4f9459d
commit b8aa74af0e
No known key found for this signature in database
GPG Key ID: 8597D87419DEF278
1 changed files with 6 additions and 4 deletions

View File

@ -213,9 +213,8 @@ uint32 Steam_Apps::GetInstalledDepots( AppId_t appID, DepotId_t *pvecDepots, uin
// returns current app install folder for AppID, returns folder name length
uint32 Steam_Apps::GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchFolderBufferSize )
{
PRINT_DEBUG("GetAppInstallDir %u %u\n", appID, cchFolderBufferSize);
PRINT_DEBUG("GetAppInstallDir %u %p %u\n", appID, pchFolder, cchFolderBufferSize);
//TODO return real path instead of dll path
if (!pchFolder || !cchFolderBufferSize) return 0;
std::string installed_path = settings->getAppInstallPath(appID);
if (installed_path.size() == 0) {
@ -232,8 +231,11 @@ uint32 Steam_Apps::GetAppInstallDir( AppId_t appID, char *pchFolder, uint32 cchF
}
PRINT_DEBUG("path %s\n", installed_path.c_str());
snprintf(pchFolder, cchFolderBufferSize, "%s", installed_path.c_str());
return strlen(pchFolder);
if (cchFolderBufferSize && pchFolder) {
snprintf(pchFolder, cchFolderBufferSize, "%s", installed_path.c_str());
}
return installed_path.length(); //Real steam always returns the actual path length, not the copied one.
}
// returns true if that app is installed (not necessarily owned)