| ... | @@ -305,11 +305,7 @@ pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name: | ... | @@ -305,11 +305,7 @@ pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name: |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| 307 | | 307 | |
| 308 | const cwdpath = try std.fs.cwd().realpathAlloc(alloc, "."); | 308 | const fpath = try mdir.realpathAlloc(alloc, "."); |
| 309 | const mpath = try mdir.realpathAlloc(alloc, "."); | | |
| 310 | var fpath = extras.trimPrefix(mpath, cwdpath); | | |
| 311 | if (fpath.len == 0) fpath = std.fs.path.sep_str; | | |
| 312 | | | |
| 313 | var cachedir = try std.fs.cwd().openDir(cachepath, .{}); | 309 | var cachedir = try std.fs.cwd().openDir(cachepath, .{}); |
| 314 | defer cachedir.close(); | 310 | defer cachedir.close(); |
| 315 | try cachedir.makePath("files"); | 311 | try cachedir.makePath("files"); |
| ... | @@ -318,7 +314,7 @@ pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name: | ... | @@ -318,7 +314,7 @@ pub fn add_files_package(alloc: std.mem.Allocator, cachepath: string, pkg_name: |
| 318 | const rff = try destdir.createFile(fname, .{}); | 314 | const rff = try destdir.createFile(fname, .{}); |
| 319 | defer rff.close(); | 315 | defer rff.close(); |
| 320 | const w = rff.writer(); | 316 | const w = rff.writer(); |
| 321 | try w.print("const srcpath = \"../../../{}\";\n\n", .{std.zig.fmtEscapes(fpath[1..])}); | 317 | try w.print("const srcpath = \"/{}\";\n\n", .{std.zig.fmtEscapes(fpath[1..])}); |
| 322 | var iter = map.iterator(); | 318 | var iter = map.iterator(); |
| 323 | while (iter.next()) |item| { | 319 | while (iter.next()) |item| { |
| 324 | try w.print("pub const @\"/{}\" = @embedFile(srcpath ++ \"/{}\");\n", .{ std.zig.fmtEscapes(item.key_ptr.*), std.zig.fmtEscapes(item.value_ptr.*) }); | 320 | try w.print("pub const @\"/{}\" = @embedFile(srcpath ++ \"/{}\");\n", .{ std.zig.fmtEscapes(item.key_ptr.*), std.zig.fmtEscapes(item.value_ptr.*) }); |