[
  {
    "Id": "581812",
    "ThreadId": "250040",
    "Html": "<p>Hopefully, I'm missing something obvious.</p>\n<p>...The most basic extract functionality does not work for me. The code below works in the case where the condition is false.</p>\n<pre>using (var archive = ZipFile.Read(tarFile)) { foreach (var file in archive) {...\n\nvar extractionFolder = file.FileName.EndsWith(\".cs\") ? dir :&nbsp;// if this is true, Extract just doesn't work</pre>\n<pre><span style=\"white-space: pre;\">\t</span>Path.Combine(dir, \"SubFolder\");&nbsp;// if this is true, it works fine</pre>\n<pre>file.Extract(extractionFolder, ExtractExistingFileAction.OverwriteSilently);\n\n</pre>\n<p>* I found the file! It is extracting it! But it's using the PATH it was originally zipped up with c:\\bla\\user\\appdata\\temp and appending that to the folder I've given it.</p>\n<p>The problem seems to be that the zipfile.FileName is being set as the 'full path' not just the filename when I archive it. So when I go to extract this particular file, it extracts out to the path it has in it's 'FileName' property, which is wrong</p>\n<p>The other files work because they're being added using AddDirectory()... for some reason they don't retain the full path in their FileName property and the single file does</p>\n<p>&nbsp;</p>\n<p>So I gather you are not expecting anyone, to create an archive like this:</p>\n<p><span>&nbsp;</span></p>\n<pre>using (var zip = new ZipFile())\n\n{\n\n  zip.AddFile(ReportProperties.AscxFullPath); // *EDIT: looks like i have to add a 2nd arg, \"\")\n\n  zip.AddFile(ReportProperties.CodeBehindFileFullPath);\n\n  zip.AddDirectory(ReportProperties.SupportFilesFullPath);&nbsp;</pre>\n<pre>  zip.Save(reportFileTarStream);\n\n}</pre>",
    "PostedDate": "2011-03-16T16:59:20.39-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "581986",
    "ThreadId": "250040",
    "Html": "<p>You need a 2nd argument to AddFile().</p>\r\n<p>The very first example on the homepage shows this. <a href=\"http://dotnetzip.codeplex.com/\">http://dotnetzip.codeplex.com/</a></p>\r\n<p>Also, the documentation describes all this.</p>\r\n<p>good luck.</p>",
    "PostedDate": "2011-03-17T03:33:31.873-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "581994",
    "ThreadId": "250040",
    "Html": "<p>You are right.</p>\n<p>But why does the call to zip.AddDirectory(\"\") not show the same behaviour?</p>\n<p>This is the crux of my question. After having figured out the answer, my query is not whether this is in the documentation but whether it makes sense.</p>\n<p>When I extract the files which were added from the AddDirectory() call, they extract properly without the 2nd argument required for the AddFile() call - given above.</p>\n<p>So, yes the first example you site has an example of a 2nd argument to the AddFile() method, but it does not also make a call to AddDirectory() where the same 2nd argument is not needed.</p>\n<p>Is this not confusing or are you happy with this inconsistency? Or have I missed something?</p>",
    "PostedDate": "2011-03-17T03:58:34.17-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]