Fix unsaved untitled files not being opened on the next session regression
Fix #11080
This commit is contained in:
parent
961a133a60
commit
2132505cba
|
@ -640,12 +640,16 @@ void FileManager::closeBuffer(BufferID id, ScintillaEditView * identifier)
|
||||||
|
|
||||||
|
|
||||||
// backupFileName is sentinel of backup mode: if it's not NULL, then we use it (load it). Otherwise we use filename
|
// backupFileName is sentinel of backup mode: if it's not NULL, then we use it (load it). Otherwise we use filename
|
||||||
BufferID FileManager::loadFile(const TCHAR * filename, Document doc, int encoding, const TCHAR *backupFileName, FILETIME fileNameTimestamp)
|
BufferID FileManager::loadFile(const TCHAR* filename, Document doc, int encoding, const TCHAR* backupFileName, FILETIME fileNameTimestamp)
|
||||||
{
|
{
|
||||||
//Get file size
|
//Get file size
|
||||||
FILE* fp = generic_fopen(filename, TEXT("rb"));
|
const TCHAR* pPath = filename;
|
||||||
|
if (!::PathFileExists(pPath))
|
||||||
|
pPath = backupFileName;
|
||||||
|
FILE* fp = generic_fopen(pPath, TEXT("rb"));
|
||||||
if (!fp)
|
if (!fp)
|
||||||
return BUFFER_INVALID;
|
return BUFFER_INVALID;
|
||||||
|
|
||||||
_fseeki64(fp, 0, SEEK_END);
|
_fseeki64(fp, 0, SEEK_END);
|
||||||
int64_t fileSize = _ftelli64(fp);
|
int64_t fileSize = _ftelli64(fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
Loading…
Reference in New Issue