Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[WIN32] fixed: ClogInit would crash on smb:// paths (i.e. if appdata …

…is on an unc share). Should handle #13366.
  • Loading branch information...
commit 4d7bfbb71f4343535478c642578e4617376b3eb1 1 parent 921f7e8
@wsoltys wsoltys authored
View
9 xbmc/utils/log.cpp
@@ -28,6 +28,8 @@
#include "utils/StdString.h"
#if defined(TARGET_ANDROID)
#include "android/activity/XBMCApp.h"
+#elif defined(TARGET_WINDOWS)
+#include "win32/WIN32Util.h"
#endif
#define critSec XBMC_GLOBAL_USE(CLog::CLogGlobals).critSec
@@ -144,6 +146,13 @@ bool CLog::Init(const char* path)
strLogFile.Format("%sxbmc.log", path);
strLogFileOld.Format("%sxbmc.old.log", path);
+#if defined(TARGET_WINDOWS)
+ // the appdata folder might be redirected to an unc share
+ // convert smb to unc path that stat and fopen can handle it
+ strLogFile = CWIN32Util::SmbToUnc(strLogFile);
+ strLogFileOld = CWIN32Util::SmbToUnc(strLogFileOld);
+#endif
+
struct stat64 info;
if (stat64_utf8(strLogFileOld.c_str(),&info) == 0 &&
remove_utf8(strLogFileOld.c_str()) != 0)
View
11 xbmc/win32/WIN32Util.cpp
@@ -479,6 +479,17 @@ CStdString CWIN32Util::UncToSmb(const CStdString &strPath)
return strRetPath;
}
+CStdString CWIN32Util::SmbToUnc(const CStdString &strPath)
+{
+ CStdString strRetPath(strPath);
+ if(strRetPath.Left(6).Equals("smb://"))
+ {
+ strRetPath.Replace("smb://","\\\\");
+ strRetPath.Replace("/","\\");
+ }
+ return strRetPath;
+}
+
void CWIN32Util::ExtendDllPath()
{
CStdStringW strEnvW;
View
1  xbmc/win32/WIN32Util.h
@@ -60,6 +60,7 @@ class CWIN32Util
static CStdString CWIN32Util::GetSystemPath();
static CStdString GetProfilePath();
static CStdString UncToSmb(const CStdString &strPath);
+ static CStdString SmbToUnc(const CStdString &strPath);
static void ExtendDllPath();
static HRESULT ToggleTray(const char cDriveLetter='\0');
static HRESULT EjectTray(const char cDriveLetter='\0');
Please sign in to comment.
Something went wrong with that request. Please try again.