.NET:如何设置“扩展文件属性"以跨平台的方式? [英] .NET: How to set "extended file attributes" in a cross-platform way?
问题描述
我需要在 .NET 5 控制台应用程序中阅读和修改扩展文件属性必须适用于 Windows 和 Linux(假设文件系统支持这些属性).
I need to read and modify extended file attributes in a .NET 5 console application that must work on Windows and Linux (assuming that the files system supports those attributes).
这个问题之前也被问过(?)特定的上下文:
This question has been asked with too(?) specific contexts before:
- 自定义文件属性(从 2013 年开始,没有跨平台)
- 在 C# 中获取任何扩展文件属性(来自2015,专注于特殊情况或平台特定的解决方案)
- 在 .Net Core 中获取文件扩展属性(从 2017 年开始), 跨平台,但仅限于某些特殊属性)
- Custom File Properties (from 2013, no cross-platform)
- Getting ANY extended file attribute in C# (from 2015, focusing on special cases or platform-specific solutions)
- Obtaining file extended properties in .Net Core (from 2017, cross-platform, but restricted to some special attributes)
所以几年后,我想以非常通用的方式再次询问那些扩展文件属性,以获得明确的、有效的、跨平台的答案.关于维基百科文章扩展文件属性"中的这些属性.我想添加任意的(不限于标题或作者之类的).任何键/值对.
So some years later I want to ask again in a very generic way about those extended file attributes to get a definitive, working, cross-platform answer. About those attributes from the Wikipedia article "Extended file attributes". I want to add arbitrary ones (not restricted to Title or Author or something). Any key/value pair.
我应该使用哪些 .NET API?
Which .NET APIs should I use?
推荐答案
目前还没有 API.这是我添加它的建议:https://github.com/dotnet/runtime/issues/49604
There is no API (yet). Here's my proposal to add it: https://github.com/dotnet/runtime/issues/49604
这篇关于.NET:如何设置“扩展文件属性"以跨平台的方式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!