模块

std.path

固定缓冲区路径辅助,具有显式存储和目标感知限制。

状态

当前可运行:

API返回值说明
std.path.join(buffer, left, right)Maybe<String>将两个路径片段拼接写入调用者提供的固定缓冲区。

当前范围:

  • readBytes/writeBytes 与面向资源的 Fs/File API 并存,因为它们是实用的小程序便捷方法。
  • basenamedirname 和扩展名辅助函数不属于当前 API。
  • 该模块刻意保持精简,并非通用路径规范化库。

示例

pub fn main Void world World !  mut storage [64]u8 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]  let path std.path.join storage ".zero" "example.txt"  if path.has    check world.out.write path.value    check world.out.write "\n"

设计说明

std.path.join 写入调用者提供的存储空间,当缓冲区过小时返回 null。不进行堆分配。

当前行为使用 / 作为可移植的包/示例分隔符。在添加目标特定路径规则之前,Windows 路径规范化仍是一项已记录的限制。