1515using System ;
1616using System . Collections . Generic ;
1717using System . Data ;
18+ using System . Diagnostics ;
1819using System . IO ;
1920using System . IO . Compression ;
2021using System . Linq ;
@@ -98,11 +99,11 @@ public string Convert(long datasetVersionId)
9899 {
99100 // generate metadata
100101 string metadataFilePath = helper . GenerateResourceMetadata ( concept . Id , metadatastructureId , datasetversion . Metadata , folder , xsdPath ) ;
101- if ( File . Exists ( metadataFilePath ) ) archive . AddFileToArchive ( metadataFilePath , "" ) ;
102+ if ( File . Exists ( metadataFilePath ) ) archive . AddFileToArchive ( metadataFilePath , Path . GetFileName ( metadataFilePath ) ) ;
102103
103104 // get data
104105 string datapath = helper . GenerateData ( id , versionId ) ;
105- if ( File . Exists ( datapath ) ) archive . AddFileToArchive ( datapath , "" ) ;
106+ if ( File . Exists ( datapath ) ) archive . AddFileToArchive ( datapath , Path . GetFileName ( datapath ) ) ;
106107
107108 // has links to extentions? (IsDwcEventOf,IsDwcHumboltExtensionOf, IsEwcEMofExtensionOf)
108109 // has links?
@@ -126,14 +127,14 @@ public string Convert(long datasetVersionId)
126127 var extention = helper . GetExtention ( r . ReferenceType ) ;
127128
128129 extentions . Add ( new ExtentionEntity ( ) { IdIndex = 0 , Version = r . SourceVersion , StructureId = structureId , Extention = extention , dataPath = Path . GetFileName ( rPath ) } ) ;
129- archive . AddFileToArchive ( rPath , "" ) ;
130+ archive . AddFileToArchive ( rPath , Path . GetFileName ( rPath ) ) ;
130131 }
131132 }
132133 }
133134
134135 // generate meta file
135136 string metaFilePath = helper . GenerateMeta ( _type , dataset . DataStructure . Id , folder , Path . GetFileName ( datapath ) , extentions ) ;
136- if ( File . Exists ( metaFilePath ) ) archive . AddFileToArchive ( metaFilePath , "" ) ;
137+ if ( File . Exists ( metaFilePath ) ) archive . AddFileToArchive ( metaFilePath , Path . GetFileName ( metaFilePath ) ) ;
137138 }
138139
139140 return zipfilepath ;
0 commit comments