@@ -2587,9 +2587,10 @@ pub const Display = struct {
25872587 app_version : [:0 ]const u8 ,
25882588 app_id : [:0 ]const u8 ,
25892589 dev_resource_folder : []const u8 ,
2590+ dev_resource_filter : ? fn (name : []const u8 , extension : Resource.Type ) bool ,
25902591 translation_filename : []const u8 ,
25912592 gui_flags : usize ,
2592- ) (Error || Allocator .Error || Resources .Error || error { Utf8ExpectedContinuation , Utf8OverlongEncoding , Utf8EncodesSurrogateHalf , Utf8CodepointTooLarge , Utf8InvalidStartByte })! * Display {
2593+ ) (Error || Allocator .Error || Resources .Error || engine . Error || error { Utf8ExpectedContinuation , Utf8OverlongEncoding , Utf8EncodesSurrogateHalf , Utf8CodepointTooLarge , Utf8InvalidStartByte } || std . fs . Dir . StatError || std . fs . File . StatError || std . fs . File . OpenError )! * Display {
25932594 var display = try gpa .create (Display );
25942595 errdefer gpa .destroy (display );
25952596 display .allocator = gpa ;
@@ -2651,7 +2652,12 @@ pub const Display = struct {
26512652 }
26522653
26532654 debug ("Initialising resource loader" , .{});
2654- display .resources = try init_resource_loader (gpa , engine .RESOURCE_BUNDLE_FILENAME , dev_resource_folder );
2655+ display .resources = try init_resource_loader (
2656+ gpa ,
2657+ engine .RESOURCE_BUNDLE_FILENAME ,
2658+ dev_resource_folder ,
2659+ dev_resource_filter ,
2660+ );
26552661 if (try display .resources .lookupOne (translation_filename , .csv , gpa )) | resource | {
26562662 const data = try sdl_load_resource (display .resources , resource , gpa );
26572663 defer gpa .free (data );
@@ -4652,7 +4658,7 @@ pub const Display = struct {
46524658 };
46534659 info ("making resource bundle: {s}" , .{buffer .slice ()});
46544660
4655- display .resources .save_bundle (buffer .slice (), manifest .items ) catch | e | {
4661+ display .resources .save_bundle (buffer .slice (), manifest .items , .{}, "/tmp" ) catch | e | {
46564662 info ("save resource bundle failed. {s} {any}" , .{ buffer .slice (), e });
46574663 };
46584664 } else {
@@ -5531,14 +5537,14 @@ const eq = std.testing.expectEqual;
55315537test "init catch" {
55325538 const allocator = std .testing .allocator ;
55335539 // The display takes ownership of the resources object
5534- var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , "test translation" , 0 );
5540+ var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , null , "test translation" , 0 );
55355541 defer display .destroy (allocator );
55365542}
55375543
55385544test "button sizing" {
55395545 const allocator = std .testing .allocator ;
55405546 // The display takes ownership of the resources object
5541- var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , "test translation" , 0 );
5547+ var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , null , "test translation" , 0 );
55425548 defer display .destroy (allocator );
55435549 _ = try display .load_font (allocator , "Roboto-Light" );
55445550 try eq (1 , display .fonts .items .len );
@@ -5603,7 +5609,7 @@ test "button sizing" {
56035609test "text input sizing" {
56045610 const allocator = std .testing .allocator ;
56055611 // The display takes ownership of the resources object
5606- var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , "test translation" , 0 );
5612+ var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , null , "test translation" , 0 );
56075613 defer display .destroy (allocator );
56085614
56095615 // Add test font so we can test label layout
@@ -5751,7 +5757,7 @@ test "text input sizing" {
57515757
57525758test "test_init" {
57535759 const allocator = std .testing .allocator ;
5754- var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , "test translation" , 0 );
5760+ var display = try Display .create (allocator , "test" , "test" , "test" , "./test/repo" , null , "test translation" , 0 );
57555761 defer display .destroy (allocator );
57565762 var panel = try create_panel (allocator , display , .{
57575763 .rect = .{ .width = 500 , .height = 200 },
0 commit comments