因与 OpenAI 合作而被删除。我的帐户很可能会被删除,这是我的意图

问题描述 投票:0回答:1

因与 OpenAI 合作而被删除。我的帐户很可能会被删除,这是我的意图。

zig
1个回答
4
投票

一个选项是

realpath

std.fs.Dir.realpathAlloc(self: Dir, 分配器: 分配器, 路径名: []const u8) ![]u8

const std = @import("std");

pub fn main() !void {
    var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
    defer arena.deinit();
    const alloc = arena.allocator();

    std.log.info("cwd: {s}", .{
        try std.fs.cwd().realpathAlloc(alloc, "."),
    });
}

realpath 内部调用

std.os.getFdPath
,而 Dir 上似乎没有任何函数可以立即执行此操作。

© www.soinside.com 2019 - 2024. All rights reserved.