【发布时间】:2019-12-12 15:18:19
【问题描述】:
DotNetZip 创建具有 000 权限(不读取、不写入、不执行)的 zip 文件,因此我无法在 Linux 上轻松打开它们(Windows 资源管理器不关心它并正常打开文件)。 Windows 上的相同代码生成具有读取权限的文件(在 Linux 上):
using (var fs = new System.IO.FileStream("./test.zip"))
{
using (var archive = new System.IO.Compression.ZipArchive(fs, ZipArchiveMode.Create))
{
var entry = archive.CreateEntry("test.txt");
using (var writer = new System.IO.StreamWriter(entry.Open()))
{
writer.Write("Hello World");
}
}
}
我可以设置权限或模拟System.IO.Compression 在 Windows 上运行吗?
【问题讨论】:
-
创建文件后尝试使用此更改文件权限stackoverflow.com/questions/45132081/…
标签: c# linux permissions zip