File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -308,11 +308,25 @@ const ContentWriter = struct {
308308 .dependency ,
309309 .src_path ,
310310 = > {
311+
311312 // We can safely call getPath2 as we can fully resolve the path
312313 // already
313- const full_path = path .getPath2 (cw .wfs .step .owner , & cw .wfs .step );
314-
315- std .debug .assert (std .fs .path .isAbsolute (full_path ));
314+ const rel_path = path .getPath2 (cw .wfs .step .owner , & cw .wfs .step );
315+
316+ const full_path = if (! std .fs .path .isAbsolute (rel_path ))
317+ std .fs .cwd ().realpathAlloc (cw .wfs .step .owner .allocator , rel_path ) catch @panic ("oom" )
318+ else
319+ rel_path ;
320+
321+ if (! std .fs .path .isAbsolute (full_path )) {
322+ const cwd = std .fs .cwd ().realpathAlloc (cw .wfs .step .owner .allocator , "." ) catch @panic ("oom" );
323+ std .debug .print ("non-absolute path detected for {t}: cwd=\" {f}\" path=\" {f}\" \n " , .{
324+ path ,
325+ std .zig .fmtString (cwd ),
326+ std .zig .fmtString (full_path ),
327+ });
328+ @panic ("non-absolute path detected!" );
329+ }
316330
317331 try writer .print ("{f}" , .{
318332 fmtPath (full_path ),
You can’t perform that action at this time.
0 commit comments