0

Im trying to decompress a bz2 file via code using the ICSharpCode.SharpZipLib.

It seems no matter where I make my file, even though I have FULL ACCESS control over it, I keep getting this Exception. Any help greatly appreciated.

using System;
using System.IO;

using ICSharpCode.SharpZipLib.BZip2;

namespace decompressor 
{ 
    class MainClass
    {
        public static void Main(string[] args)
        {
            string filePath = "C:\\FreeBase\\opinions.tsv.bz2";
            string decompressPath = "C:\\Users\\mike\\Desktop\\Decompressed";

            Console.WriteLine("Decompressing {0} to {1}", file, path);
             BZip2.Decompress(File.OpenRead(filePath),File.OpenWrite(decompressPath), true);                
        }       
    }
}
JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
tap
  • 553
  • 2
  • 8
  • 16

2 Answers2

1

Your code can have no access to create new paths at your desktop. Check the permissions for the "C:\\Users\\mike\\Desktop\\Decompressed".

VMAtm
  • 27,943
  • 17
  • 79
  • 125
  • 1
    Then why are you using this: `File.Create(path)`? Do your code have permissions for that file? – VMAtm Jul 15 '11 at 20:22
0

Maybe, you should write so:

string decompressPath = "C:\\Users\\mike\\Desktop\\Decompressed\\opinions.tsv";
hotenov
  • 911
  • 1
  • 11
  • 17