From 249407784bac17dcb74e15d9cb68cc7336f52a96 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Tue, 18 Feb 2025 15:32:37 -0800 Subject: [PATCH] macOS plist to support arrays --- .../macos/Runner/Info.plist | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/{{cookiecutter.out_dir}}/macos/Runner/Info.plist b/{{cookiecutter.out_dir}}/macos/Runner/Info.plist index 7e273e2..a87e6be 100644 --- a/{{cookiecutter.out_dir}}/macos/Runner/Info.plist +++ b/{{cookiecutter.out_dir}}/macos/Runner/Info.plist @@ -28,14 +28,35 @@ MainMenu NSPrincipalClass NSApplication - - {{ k }} - - - - - - {{ v }} - + + {% macro render_dict(d) -%} + {% for key, value in d.items() -%} + {{ key }} + {% if value is string -%} + {{ value }} + {% elif value is boolean -%} + <{{ "true" if value else "false" }}/> + {% elif value is mapping -%} + + {{ render_dict(value) }} + + {% elif value is sequence -%} {# Support for lists/arrays #} + + {% for item in value -%} + {% if item is string -%} + {{ item }} + {% elif item is boolean -%} + <{{ "true" if item else "false" }}/> + {% elif item is mapping -%} + + {{ render_dict(item) }} + + {% endif -%} + {% endfor -%} + + {% endif -%} + {% endfor -%} + {% endmacro -%} + {{ render_dict(cookiecutter.options.info_plist) }} \ No newline at end of file