@@ -1319,16 +1319,29 @@ fn doTarget(
13191319
13201320 const embedded_files = blk : {
13211321 var opts = module_options ;
1322- opts .root_source_file = b .path ("build_resources/embedded_files.zig" );
1322+ const root_path = "build_resources/embedded_files.zig" ;
1323+ opts .root_source_file = b .path (root_path );
13231324 const obj = b .addObject (.{
13241325 .name = "embedded_files" ,
13251326 .root_module = b .createModule (opts ),
13261327 });
13271328 {
13281329 var embedded_files_options = b .addOptions ();
13291330 if (build_context .dep_floe_logos ) | logos | {
1330- embedded_files_options .addOptionPath ("logo_file" , logos .path ("rasterized/plugin-gui-logo.png" ));
1331- embedded_files_options .addOptionPath ("icon_file" , logos .path ("rasterized/icon-background-256px.png" ));
1331+ const update = b .addUpdateSourceFiles ();
1332+
1333+ // Zig's @embedFile only works with paths lower than the root_source_file, so we have to copy them
1334+ // into a subfolder and work out the relative paths.
1335+ const logo_path = "build_resources/external/logo.png" ;
1336+ update .addCopyFileToSource (logos .path ("rasterized/plugin-gui-logo.png" ), logo_path );
1337+ const icon_path = "build_resources/external/icon.png" ;
1338+ update .addCopyFileToSource (logos .path ("rasterized/icon-background-256px.png" ), icon_path );
1339+ embedded_files_options .step .dependOn (& update .step );
1340+
1341+ const root_dir = std .fs .path .dirname (root_path ).? ;
1342+
1343+ embedded_files_options .addOption (? []const u8 , "logo_file" , std .fs .path .relative (b .allocator , root_dir , logo_path ) catch unreachable );
1344+ embedded_files_options .addOption (? []const u8 , "icon_file" , std .fs .path .relative (b .allocator , root_dir , icon_path ) catch unreachable );
13321345 } else {
13331346 embedded_files_options .addOption (? []const u8 , "logo_file" , null );
13341347 embedded_files_options .addOption (? []const u8 , "icon_file" , null );
0 commit comments