Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Path Contexts

未关闭
#2 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
csharp

调研方向

未指定任何文件或测试。首先定位现有的 *Path types 和 LocalPath,然后跟踪它们的构造函数及路径操作。完成的标准是这些类型共享一个路径上下文 API,支持分隔符、平台行为、验证、自定义构造函数上下文,以及 TODO 中描述的 LocalPathContext.Instance 默认行为。

由索引模型根据 Issue 内容生成。

描述

enhancement help wanted

We'll need a file system API for virtual paths. Local path (#1) should implement the same API, so it should be possible to abstract over both kinds of paths.

The API should allow to:

  • manipulate foreign paths, e.g. Windows paths on a Linux computer, and vice versa;
  • introduce fully virtual file systems.

Currently, I am thinking of adding a new field of type IFileSystem or IPathContext to each of our path types: hopefully, this won't create too much overhead for their storage.

Default constructors would rely on a singleton instance for the current system, something like new LocalPath("foo") => new LocalPath("foo", LocalFileSystem.Instance).

There should be a way for the user to introduce custom path validation in constructor. For example, if they want to somehow avoid Windows paths on Linux and want to throw on new LocalPath(CustomContext, @"C:\Windows"), even though this path is valid.

TODO

  • Introduce a field into all *Path types.
  • Derive the path manipulation operations to the path context:
    • path separators,
    • behavior aspects such as Windows drives,
    • path validation in constructors (even for LocalPath that doesn't do any validation otherwise).
  • Allow passing the context to path constructors.
  • The constructors should delegate to some LocalPathContext.Instance by default (if nothing else is passed).
  • LocalPathContext.Instance should be a writable field (for global custom override).
  • Future enhancement request: allow ThreadLocal and/or AsyncLocal override for LocalPathContext, to avoid reliance on the global state.
主要语言
C#
星标
104
派生
19
平均合并
13 小时 42 分钟
30 天内合并 PR
9

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ForNeVeR/TruePath 的其他 Issue

查看 ForNeVeR/TruePath 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。