如何修复系统.解压bz2文件时出现UnauthorizedAccessException异常



我试图通过使用ICSharpCode.SharpZipLib.代码解压bz2文件。

似乎无论我在哪里制作我的文件,即使我对它有完全访问控制,我总是得到这个异常。如有任何帮助,不胜感激。

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);                
        }       
    }
}

您的代码无法在桌面上创建新路径。检查"C:\Users\mike\Desktop\Decompressed"的权限

也许,你应该这样写:

string decompressPath = "C:\Users\mike\Desktop\Decompressed\opinions.tsv";

相关内容

  • 没有找到相关文章

最新更新