//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)
{
if (GetFullPathNameW(strPathW, bufSize, buf, NULL) <= bufSize-1)
{
std::wstring expandedPathW(buf);
- RemoveExtraLongPathPrefix(expandedPathW);
+ CWIN32Util::RemoveExtraLongPathPrefix(expandedPathW);
g_charsetConverter.wToUTF8(expandedPathW, strPath);
}
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
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
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;
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');