From 09b1063c73206cffb1819530498ef209e393a1a3 Mon Sep 17 00:00:00 2001 From: stuconnolly Date: Thu, 26 Aug 2010 18:49:05 +0000 Subject: If the user chooses to overwrite the output file(s) when performing an export make sure compression and CSV and XML headers and re-enable/rewritten. --- Source/SPExportFileUtilities.m | 11 ++++++++++- Source/SPExportInitializer.m | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'Source') diff --git a/Source/SPExportFileUtilities.m b/Source/SPExportFileUtilities.m index 23eb7666..e256b1be 100644 --- a/Source/SPExportFileUtilities.m +++ b/Source/SPExportFileUtilities.m @@ -180,7 +180,16 @@ { if ([file exportFileHandleStatus] == SPExportFileHandleExists) { - [file createExportFileHandle:YES]; + if ([file createExportFileHandle:YES] == SPExportFileHandleCreated) { + [file setCompressionFormat:[exportOutputCompressionFormatPopupButton indexOfSelectedItem]]; + + if ([file exportFileNeedsCSVHeader]) { + [self writeCSVHeaderToExportFile:file]; + } + else if ([file exportFileNeedsXMLHeader]) { + [self writeXMLHeaderToExportFile:file]; + } + } } } diff --git a/Source/SPExportInitializer.m b/Source/SPExportInitializer.m index 4812dd82..ee184701 100644 --- a/Source/SPExportInitializer.m +++ b/Source/SPExportInitializer.m @@ -400,8 +400,8 @@ { if ([exportFile createExportFileHandle:NO] == SPExportFileHandleCreated) { - // TODO: these will not currently get triggered if there's an error in creating the files - eg when the user later chooses "overwrite". [exportFile setCompressionFormat:[exportOutputCompressionFormatPopupButton indexOfSelectedItem]]; + if ([exportFile exportFileNeedsCSVHeader]) { [self writeCSVHeaderToExportFile:exportFile]; } -- cgit v1.2.3