From 2716aaf73ba3307161d23e21430f3236297c8b10 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 29 Jul 2012 22:00:14 +0200 Subject: [PATCH] Added basic support for long filenames Signed-off-by: Sven Strickroth --- src/Git/TGitPath.cpp | 6 +++++- src/Git/TGitPath.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Git/TGitPath.cpp b/src/Git/TGitPath.cpp index 065281431..6c66b3ab4 100644 --- a/src/Git/TGitPath.cpp +++ b/src/Git/TGitPath.cpp @@ -169,6 +169,7 @@ void CTGitPath::SetFromWin(LPCTSTR pPath) { Reset(); m_sBackslashPath = pPath; + m_sBackslashPath.Replace(L"\\\\?\\", L""); SanitizeRootPath(m_sBackslashPath, false); ATLASSERT(m_sBackslashPath.Find('/')<0); } @@ -176,6 +177,7 @@ void CTGitPath::SetFromWin(const CString& sPath) { Reset(); m_sBackslashPath = sPath; + m_sBackslashPath.Replace(L"\\\\?\\", L""); SanitizeRootPath(m_sBackslashPath, false); } void CTGitPath::SetFromWin(LPCTSTR pPath, bool bIsDirectory) @@ -426,7 +428,9 @@ void CTGitPath::UpdateAttributes() const { EnsureBackslashPathSet(); WIN32_FILE_ATTRIBUTE_DATA attribs; - if(GetFileAttributesEx(m_sBackslashPath, GetFileExInfoStandard, &attribs)) + if (m_sBackslashPath.GetLength() >= 248) + m_sLongBackslashPath = _T("\\\\?\\") + m_sBackslashPath; + if(GetFileAttributesEx(m_sBackslashPath.GetLength() >= 248 ? m_sLongBackslashPath : m_sBackslashPath, GetFileExInfoStandard, &attribs)) { m_bIsDirectory = !!(attribs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); m_lastWriteTime = *(__int64*)&attribs.ftLastWriteTime; diff --git a/src/Git/TGitPath.h b/src/Git/TGitPath.h index 67ac659f2..f88d6fd74 100644 --- a/src/Git/TGitPath.h +++ b/src/Git/TGitPath.h @@ -314,6 +314,7 @@ private: private: mutable CString m_sBackslashPath; + mutable CString m_sLongBackslashPath; mutable CString m_sFwdslashPath; mutable CString m_sUIPath; mutable CStringA m_sUTF8FwdslashPath; -- 2.11.4.GIT