Skip to content

Compile Error for Local Dependencies on Windows #80

@brodeuralexis

Description

@brodeuralexis

deps.zig fails to compile with a message like so:

$ zig build run-simple
C:\Users\Alexis Brodeur\Projects\github.com\brodeuralexis\webgpu\deps.zig:67:129: error: invalid escape character: 's'
        .pkg = Pkg{ .name = "webgpu-backend-dummy", .source = .{ .path = dirs._5lfigtl33bkz ++ "/./modules/webgpu-backend-dummy\src/backend.zig" }, .dependencies = null },      

Both of these snippets of code make it so deps.zig generated on Windows does not compile if local dependencies are used:

if (d.type == .local) dd.main = try std.fs.path.join(options.alloc, &.{ d.main, save.main });

This uses the primary separator, which is \ on Windows.

zigmod/src/cmd/fetch.zig

Lines 287 to 293 in 6a2d664

try w.print(
\\ .pkg = Pkg{{ .name = "{s}", .source = .{{ .path = dirs._{s} ++ "/{s}" }}, .dependencies =
, .{
mod.name,
mod.short_id(),
mod.main,
});

This does not escape special characters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions