MCPcopy Create free account
hub / github.com/WinMerge/winmerge / LoadOneFile

Method LoadOneFile

Src/HexMergeDoc.cpp:491–515  ·  view source on GitHub ↗

* @brief Load one file */

Source from the content-addressed store, hash-verified

489* @brief Load one file
490*/
491HRESULT CHexMergeDoc::LoadOneFile(int index, const tchar_t* filename, bool readOnly, const String& strDesc)
492{
493 if (filename[0] && !paths::IsNullDeviceName(filename))
494 {
495 if (Try(m_pView[index]->LoadFile(filename), MB_ICONSTOP) != 0)
496 return E_FAIL;
497 m_pView[index]->SetReadOnly(readOnly);
498 m_filePaths.SetPath(index, filename, false);
499 ASSERT(m_nBufferType[index] == BUFFERTYPE::NORMAL); // should have been initialized to BUFFERTYPE::NORMAL in constructor
500 if (!strDesc.empty())
501 {
502 m_strDesc[index] = strDesc;
503 m_nBufferType[index] = BUFFERTYPE::NORMAL_NAMED;
504 }
505 }
506 else
507 {
508 m_nBufferType[index] = BUFFERTYPE::UNNAMED;
509 m_strDesc[index] = strDesc;
510 if (m_strDesc[index].empty())
511 m_strDesc[index] = (index == 0) ? _("Untitled Left") : ((m_nBuffers < 3 || index == 2) ? _("Untitled Right") : _("Untitled Middle"));
512 }
513 m_pView[index]->ResizeWindow();
514 return S_OK;
515}
516
517/**
518 * @brief Load files and initialize frame's compare result icon

Callers

nothing calls this directly

Calls 7

IsNullDeviceNameFunction · 0.85
TryFunction · 0.85
ResizeWindowMethod · 0.80
LoadFileMethod · 0.45
SetReadOnlyMethod · 0.45
SetPathMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected