MCPcopy Create free account
hub / github.com/MrNeRF/LichtFeld-Studio / SaveBuffer

Method SaveBuffer

external/zep/src/editor.cpp:232–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

230 }
231
232 void ZepEditor::SaveBuffer(ZepBuffer& buffer) {
233 // TODO:
234 // - What if the buffer has no associated file? Prompt for one.
235 // - We don't check for outside modification yet either, meaning this could overwrite
236 std::ostringstream strText;
237
238 if (buffer.HasFileFlags(FileFlags::ReadOnly)) {
239 strText << "Failed to save, Read Only: " << buffer.GetDisplayName();
240 } else if (buffer.HasFileFlags(FileFlags::Locked)) {
241 strText << "Failed to save, Locked: " << buffer.GetDisplayName();
242 } else if (buffer.GetFilePath().empty()) {
243 strText << "Error: No file name";
244 } else {
245 int64_t size;
246 if (!buffer.Save(size)) {
247 strText << "Failed to save: " << buffer.GetDisplayName() << " at: " << buffer.GetFilePath().string();
248 } else {
249 strText << "Wrote " << buffer.GetFilePath().string() << ", " << size << " bytes";
250 }
251 }
252 SetCommandText(strText.str());
253 }
254
255 std::vector<ZepWindow*> ZepEditor::FindBufferWindows(const ZepBuffer* pBuffer) const {
256 std::vector<ZepWindow*> bufferWindows;

Callers 2

GetCommandMethod · 0.80
HandleExCommandMethod · 0.80

Calls 7

HasFileFlagsMethod · 0.80
GetDisplayNameMethod · 0.80
GetFilePathMethod · 0.80
SaveMethod · 0.80
stringMethod · 0.80
strMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected