Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #3199 from Karlson2k/win32_home_fix_02

Move Add/RemoveExtraLongPathPrefix functions to WIN32Util class
  • Loading branch information...
commit 1a8719806a38abdd09d90e81e869c525d7c7624b 2 parents 98d814c + 37a0c4f
@wsoltys wsoltys authored
View
28 xbmc/Util.cpp
@@ -397,7 +397,7 @@ void CUtil::GetHomePath(CStdString& strPath, const CStdString& strTarget)
//expand potential relative path to full path
CStdStringW strPathW;
g_charsetConverter.utf8ToW(strPath, strPathW, false);
- AddExtraLongPathPrefix(strPathW);
+ CWIN32Util::AddExtraLongPathPrefix(strPathW);
const unsigned int bufSize = GetFullPathNameW(strPathW, 0, NULL, NULL);
if (bufSize != 0)
{
@@ -405,7 +405,7 @@ void CUtil::GetHomePath(CStdString& strPath, const CStdString& strTarget)
if (GetFullPathNameW(strPathW, bufSize, buf, NULL) <= bufSize-1)
{
std::wstring expandedPathW(buf);
- RemoveExtraLongPathPrefix(expandedPathW);
+ CWIN32Util::RemoveExtraLongPathPrefix(expandedPathW);
g_charsetConverter.wToUTF8(expandedPathW, strPath);
}
@@ -1503,30 +1503,6 @@ bool CUtil::MakeShortenPath(CStdString StrInput, CStdString& StrOutput, int iTex
return true;
}
-#ifdef TARGET_WINDOWS
-bool CUtil::AddExtraLongPathPrefix(std::wstring& path)
-{
- const wchar_t* const str = path.c_str();
- if (path.length() < 4 || str[0] != L'\\' || str[1] != L'\\' || str[3] != L'\\' || str[2] != L'?')
- {
- path.insert(0, L"\\\\?\\");
- return true;
- }
- return false;
-}
-
-bool CUtil::RemoveExtraLongPathPrefix(std::wstring& path)
-{
- const wchar_t* const str = path.c_str();
- if (path.length() >= 4 && str[0] == L'\\' && str[1] == L'\\' && str[3] == L'\\' && str[2] == L'?')
- {
- path.erase(0, 4);
- return true;
- }
- return false;
-}
-#endif // TARGET_WINDOWS
-
bool CUtil::SupportsWriteFileOperations(const CStdString& strPath)
{
// currently only hd, smb, nfs, afp and dav support delete and rename
View
4 xbmc/Util.h
@@ -144,10 +144,6 @@ class CUtil
static double AlbumRelevance(const CStdString& strAlbumTemp1, const CStdString& strAlbum1, const CStdString& strArtistTemp1, const CStdString& strArtist1);
static bool MakeShortenPath(CStdString StrInput, CStdString& StrOutput, int iTextMaxLength);
-#ifdef TARGET_WINDOWS
- static bool AddExtraLongPathPrefix(std::wstring& path);
- static bool RemoveExtraLongPathPrefix(std::wstring& path);
-#endif // TARGET_WINDOWS
/*! \brief Checks wether the supplied path supports Write file operations (e.g. Rename, Delete, ...)
\param strPath the path to be checked
View
22 xbmc/win32/WIN32Util.cpp
@@ -495,6 +495,28 @@ CStdString CWIN32Util::SmbToUnc(const CStdString &strPath)
return strRetPath;
}
+bool CWIN32Util::AddExtraLongPathPrefix(std::wstring& path)
+{
+ const wchar_t* const str = path.c_str();
+ if (path.length() < 4 || str[0] != L'\\' || str[1] != L'\\' || str[3] != L'\\' || str[2] != L'?')
+ {
+ path.insert(0, L"\\\\?\\");
+ return true;
+ }
+ return false;
+}
+
+bool CWIN32Util::RemoveExtraLongPathPrefix(std::wstring& path)
+{
+ const wchar_t* const str = path.c_str();
+ if (path.length() >= 4 && str[0] == L'\\' && str[1] == L'\\' && str[3] == L'\\' && str[2] == L'?')
+ {
+ path.erase(0, 4);
+ return true;
+ }
+ return false;
+}
+
void CWIN32Util::ExtendDllPath()
{
CStdString strEnv;
View
2  xbmc/win32/WIN32Util.h
@@ -59,6 +59,8 @@ class CWIN32Util
static CStdString GetProfilePath();
static CStdString UncToSmb(const CStdString &strPath);
static CStdString SmbToUnc(const CStdString &strPath);
+ static bool AddExtraLongPathPrefix(std::wstring& path);
+ static bool RemoveExtraLongPathPrefix(std::wstring& path);
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.