MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / savePanelXml

Method savePanelXml

Source/Core/CtrlrPanel/CtrlrPanelFileOperations.cpp:777–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

775}
776
777Result CtrlrPanel::savePanelXml(const File &fileToSave, CtrlrPanel *panel, const bool compressPanel)
778{
779 MemoryOutputStream dataToSave;
780
781 if (compressPanel)
782 {
783 panel->luaSavePanel (PanelFileXMLCompressed, fileToSave);
784 }
785 else
786 {
787 panel->luaSavePanel (PanelFileXML, fileToSave);
788 }
789
790 writePanelXml (dataToSave, panel, compressPanel);
791
792 if (fileToSave.hasWriteAccess())
793 {
794 if (fileToSave.replaceWithData(dataToSave.getData(), dataToSave.getDataSize()))
795 {
796 return (Result::ok());
797 }
798 else
799 {
800 return (Result::fail ("savePanelXml replaceWithData() failed on destination file "+fileToSave.getFullPathName()));
801 }
802 }
803 else
804 {
805 AlertWindow::showMessageBox(AlertWindow::WarningIcon, "Can't save panel", "I can't write to the specified file", "OK");
806 return (Result::fail ("savePanelXml now write access to file: "+fileToSave.getFullPathName()));
807 }
808}
809
810const File CtrlrPanel::askForPanelFileToSave (CtrlrPanel *panel,
811 const File &lastBrowsedDir,

Callers

nothing calls this directly

Calls 5

luaSavePanelMethod · 0.80
hasWriteAccessMethod · 0.45
replaceWithDataMethod · 0.45
getDataMethod · 0.45
getDataSizeMethod · 0.45

Tested by

no test coverage detected