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

Method DoFileSaveAs

Src/HexMergeDoc.cpp:343–377  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

341}
342
343bool CHexMergeDoc::DoFileSaveAs(int nBuffer, bool packing)
344{
345 const String &path = m_filePaths.GetPath(nBuffer);
346 String strPath;
347 String title;
348 if (nBuffer == 0)
349 title = _("Save Left File As");
350 else if (nBuffer == m_nBuffers - 1)
351 title = _("Save Right File As");
352 else
353 title = _("Save Middle File As");
354 if (SelectFile(AfxGetMainWnd()->GetSafeHwnd(), strPath, false, path.c_str(), title))
355 {
356 HRESULT hr = m_pView[nBuffer]->SaveFile(strPath.c_str());
357 if (Try(hr) == IDCANCEL)
358 return false;
359 if (FAILED(hr))
360 return false;
361 if (path.empty())
362 {
363 // We are saving scratchpad (unnamed file)
364 m_nBufferType[nBuffer] = BUFFERTYPE::UNNAMED_SAVED;
365 m_strDesc[nBuffer].erase();
366 }
367
368 m_filePaths.SetPath(nBuffer, strPath);
369 UpdateLastCompareResult();
370 UpdateHeaderPath(nBuffer);
371
372 CMergeFrameCommon::LogFileSaved(m_filePaths[nBuffer]);
373
374 return true;
375 }
376 return false;
377}
378
379/**
380 * @brief Saves left-side file

Callers

nothing calls this directly

Calls 7

SelectFileFunction · 0.85
TryFunction · 0.85
SaveFileMethod · 0.80
GetPathMethod · 0.45
emptyMethod · 0.45
eraseMethod · 0.45
SetPathMethod · 0.45

Tested by

no test coverage detected