Avoid GetLongPathName() call for files with long name
Fixes #1148; Closes #1150
This commit is contained in:
parent
51cc22fb3d
commit
86ab42031f
@ -173,8 +173,11 @@ BufferID Notepad_plus::doOpen(const generic_string& fileName, bool isRecursive,
|
||||
}
|
||||
assert(_tcslen(longFileName) == getFullPathNameResult);
|
||||
|
||||
if (_tcschr(longFileName, '~'))
|
||||
{
|
||||
// ignore the returned value of function due to win64 redirection system
|
||||
::GetLongPathName(longFileName, longFileName, longFileNameBufferSize);
|
||||
}
|
||||
|
||||
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
||||
if (isSnapshotMode && !PathFileExists(longFileName)) // UNTITLED
|
||||
|
@ -581,7 +581,10 @@ BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encodin
|
||||
|
||||
TCHAR fullpath[MAX_PATH];
|
||||
::GetFullPathName(filename, MAX_PATH, fullpath, NULL);
|
||||
if (_tcschr(fullpath, '~'))
|
||||
{
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
}
|
||||
|
||||
bool isSnapshotMode = backupFileName != NULL && PathFileExists(backupFileName);
|
||||
if (isSnapshotMode && !PathFileExists(fullpath)) // if backup mode and fullpath doesn't exist, we guess is UNTITLED
|
||||
@ -850,7 +853,10 @@ bool FileManager::backupCurrentBuffer()
|
||||
|
||||
TCHAR fullpath[MAX_PATH];
|
||||
::GetFullPathName(backupFilePath.c_str(), MAX_PATH, fullpath, NULL);
|
||||
if (_tcschr(fullpath, '~'))
|
||||
{
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
}
|
||||
|
||||
// Make sure the backup file is not read only
|
||||
DWORD dwFileAttribs = ::GetFileAttributes(fullpath);
|
||||
@ -1024,7 +1030,11 @@ bool FileManager::saveBuffer(BufferID id, const TCHAR * filename, bool isCopy, g
|
||||
|
||||
TCHAR fullpath[MAX_PATH];
|
||||
::GetFullPathName(filename, MAX_PATH, fullpath, NULL);
|
||||
if (_tcschr(fullpath, '~'))
|
||||
{
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
}
|
||||
|
||||
if (PathFileExists(fullpath))
|
||||
{
|
||||
attrib = ::GetFileAttributes(fullpath);
|
||||
@ -1501,7 +1511,10 @@ BufferID FileManager::getBufferFromName(const TCHAR* name)
|
||||
{
|
||||
TCHAR fullpath[MAX_PATH];
|
||||
::GetFullPathName(name, MAX_PATH, fullpath, NULL);
|
||||
if (_tcschr(fullpath, '~'))
|
||||
{
|
||||
::GetLongPathName(fullpath, fullpath, MAX_PATH);
|
||||
}
|
||||
|
||||
for(size_t i = 0; i < _buffers.size(); i++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user