| 775 | } |
| 776 | |
| 777 | Result 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 | |
| 810 | const File CtrlrPanel::askForPanelFileToSave (CtrlrPanel *panel, |
| 811 | const File &lastBrowsedDir, |
nothing calls this directly
no test coverage detected