tobiasschulz / tar-cs

Automatically exported from code.google.com/p/tar-cs
Other
0 stars 0 forks source link

Fixed Directory Problem #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I forked the code to fix the problem with extracting tar files using ReadToEnd. 
 Here's the code change at line 43 of tarreader.cs, which was a matter of 
rewriting the ReadToEnd method:

        public void ReadToEnd(string destDirectory)
        {
            while (MoveNext(false))
            {
                string totalPath = destDirectory + Path.DirectorySeparatorChar + FileInfo.FileName;
                string fileName = Path.GetFileName(totalPath);
                string directory = string.Empty;
                if (fileName.Length > 0)
                {
                    //directory = totalPath.Remove(totalPath.Length - fileName.Length);
                    using (FileStream file = File.Create(totalPath))
                    {
                        Read(file);
                    }
                }
                else
                {
                    directory = totalPath;
                    Directory.CreateDirectory(directory);
                }
            }
        }

I've also attached the modded file. Now it works! Just recompile with the 
attached change

Original issue reported on code.google.com by karst...@microsoft.com on 19 May 2012 at 6:21

Attachments:

GoogleCodeExporter commented 9 years ago
Karstenj,

I'm not sure which implementation you modified but it looks like you had old 
code (dated 2009). Please see the latest source in GIT and see if it works for 
you.

(I don't know if it's still relevant after 2 years :)

Original comment by vasilt...@gmail.com on 18 Jan 2014 at 11:35

GoogleCodeExporter commented 9 years ago

Original comment by vasilt...@gmail.com on 18 Jan 2014 at 11:35