[Mono-dev] File permissions lost when contents are extracted	using	ICSharpCode.SharpZipLib.Tar
    Rathna Kumar M 
    mrathnakumar at novell.com
       
    Tue Sep 18 02:00:42 EDT 2007
    
    
  
Hi,
I tried extracting the contents of a bzip2 archive using TarArchive class.
When i did the same, the files inside the archvie were all extracted but the permissions of each file was set to the default 644.(-rw-r--r--)
Please find below  the code snippet.
Please let me know  what should be done for the same to retain the permissions of the file.
P.S: The version of the dll i use for the Tar and Bzip2 types is 2.84 (ICSharpCode.SharpZipLib.dll).
------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ICSharpCode.SharpZipLib.Tar;
using ICSharpCode.SharpZipLib.BZip2;
namespace Test
{
    class ExtractBzip2
    {
        static void Main(string[] args)
        {
            TestMethod(args[0]);
        }
        public static void TestMethod(string path) {
            FileStream fs = File.OpenRead(path);
            Stream stream = new BZip2InputStream(fs);
            TarArchive tar = TarArchive.CreateInputTarArchive(stream);
            tar.ExtractContents("/home");
            stream.Close();
        }
    }
}
-----------------------------------------------------------------------------
Thanks
Rathna Kumar
    
    
More information about the Mono-devel-list
mailing list