From be39ca521067535ecd8c830f89380d4ea6b4834d Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sun, 6 Nov 2011 17:36:39 -0800 Subject: [PATCH] Fix some bugs in plStatusLog. Closes #99. --- .../PubUtilLib/plStatusLog/plStatusLog.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp index 096d4194..5df6ad41 100644 --- a/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp +++ b/Sources/Plasma/PubUtilLib/plStatusLog/plStatusLog.cpp @@ -90,6 +90,16 @@ plStatusLogMgr::plStatusLogMgr() fDrawer = nil; fLastLogChangeTime = 0; +#if HS_BUILD_FOR_WIN32 + SHGetSpecialFolderPathW(NULL, fBasePath, CSIDL_LOCAL_APPDATA, TRUE); +//#elif HS_BUILD_FOR_DARWIN +// Do some Mac specific thing here eventually +#else + wchar* temp = hsStringToWString(getenv("HOME")); + swprintf(fBasePath, MAX_PATH, L"%S/.cache/Uru Live", temp); + delete[] temp; +#endif + plFileUtils::ConcatFileName(fBasePath, L"log"); plFileUtils::EnsureFilePathExists(fBasePath); } @@ -820,7 +830,11 @@ bool plStatusLog::IPrintLineToFile( const char *line, UInt32 count ) strncat(buf, work, arrsize(work)); } - strncat(buf, line, arrsize(line)); + if (count < arrsize(buf) - strlen(buf)) { + strncat(buf, line, count); + } else { + strncat(buf, line, arrsize(buf) - strlen(buf)); + } if(!fEncryptMe ) {