1 /* 2 * Copyright 2007, 2011, Stephan Aßmus <superstippi@gmx.de>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 6 7 #include "NativeSaver.h" 8 9 #include <stdio.h> 10 #include <string.h> 11 12 #include "FlatIconFormat.h" 13 #include "MessageExporter.h" 14 15 16 NativeSaver::NativeSaver(const entry_ref& ref) 17 : 18 SimpleFileSaver(new MessageExporter(), ref), 19 fAttrSaver(ref, kVectorAttrNodeName) 20 { 21 } 22 23 24 NativeSaver::~NativeSaver() 25 { 26 } 27 28 29 status_t 30 NativeSaver::Save(Document* document) 31 { 32 status_t ret = SimpleFileSaver::Save(document); 33 if (ret != B_OK) { 34 fprintf(stderr, "Error saving icon: %s\n", strerror(ret)); 35 return ret; 36 } 37 38 WaitForExportThread(); 39 40 ret = fAttrSaver.Save(document); 41 if (ret != B_OK) { 42 fprintf(stderr, "Error saving icon attribute: %s\n", strerror(ret)); 43 return ret; 44 } 45 46 return B_OK; 47 } 48 49