aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorspiff_ <spiff_@svn>2009-12-21 20:19:59 +0000
committerspiff_ <spiff_@svn>2009-12-21 20:19:59 +0000
commit7a79b6a7d3dfa85bc9bbb8aaa058483c158cd0fd (patch)
tree3ec1bacd862bfd6ba3517ae149609e437d6a5f27
parent2eb8e2f5e2c8c9316e6bb1024f80e0135faa955e (diff)
fixed: my logging class rewrite broke win32. use wide versions
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@25944 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--xbmc/utils/log.cpp30
-rw-r--r--xbmc/utils/log.h3
2 files changed, 33 insertions, 0 deletions
diff --git a/xbmc/utils/log.cpp b/xbmc/utils/log.cpp
index 36c1eb8e92..1bda09616f 100644
--- a/xbmc/utils/log.cpp
+++ b/xbmc/utils/log.cpp
@@ -138,6 +138,10 @@ void CLog::Log(int loglevel, const char *format, ... )
bool CLog::Init(const char* path)
{
+#ifdef _WIN32
+ return InitW(path);
+#endif
+
CSingleLock waitLock(critSec);
if (!m_file)
{
@@ -162,6 +166,32 @@ bool CLog::Init(const char* path)
return m_file != NULL;
}
+bool CLog::InitW(const char* path)
+{
+ CSingleLock waitLock(critSec);
+ if (!m_file)
+ {
+ CStdStringW pathW;
+ g_charsetConverter.utf8ToW(path, pathW, false);
+ CStdStringW strLogFile, strLogFileOld;
+
+ strLogFile.Format("%sxbmc.log", pathW);
+ strLogFileOld.Format("%sxbmc.old.log", pathW);
+
+ struct stat64 info;
+ if (_wstat64(strLogFileOld.c_str(),&info) == 0 &&
+ !::DeleteFileW(strLogFileOld.c_str()))
+ return false;
+ if (_wstat64(strLogFile.c_str(),&info) == 0 &&
+ !::MoveFileW(strLogFile.c_str(),strLogFileOld.c_str()))
+ return false;
+
+ m_file = _wfopen(strLogFile.c_str(),"wb");
+ }
+
+ return m_file != NULL;
+}
+
void CLog::DebugLog(const char *format, ... )
{
#ifdef _DEBUG
diff --git a/xbmc/utils/log.h b/xbmc/utils/log.h
index bba86f9e63..a6c8db313b 100644
--- a/xbmc/utils/log.h
+++ b/xbmc/utils/log.h
@@ -58,6 +58,9 @@ public:
static void MemDump(char *pData, int length);
static void DebugLogMemory();
static bool Init(const char* path);
+#ifdef _WIN32
+ static bool InitW(const char* path);
+#endif
};
// GL Error checking macro