Skip to content

Commit e46102e

Browse files
committed
pack: windows-compatible icons
1 parent 95d8089 commit e46102e

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

scripts/pack_app.py

+19-7
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@
1010

1111
app_path = "app.py"
1212
app_name = "Tuttle"
13-
icon_path = "tuttle/app/assets/icon/macos/AppIcon.icns"
13+
14+
15+
def get_icon_path():
16+
if sys.platform.startswith("darwin"):
17+
icon_path = "tuttle/app/assets/icon/macos/AppIcon.icns"
18+
else:
19+
icon_path = "tuttle/app/assets/icon/web/icon-512-maskable.png"
20+
return icon_path
21+
1422

1523
# files to be added to the app bundle
1624
added_files = [
@@ -21,20 +29,24 @@
2129
# options to be passed to flet pack
2230
pack_options = [
2331
("--name", app_name),
24-
("--icon", icon_path),
32+
("--icon", get_icon_path()),
2533
("--product-name", app_name),
2634
("--product-version", tuttle.__version__),
2735
("--copyright", "© 2021-2023 Tuttle developers. Licsened under the GNU GPL v3.0."),
2836
]
2937

30-
if sys.platform.startswith("win"):
31-
delimiter = ";"
32-
else:
33-
delimiter = ":"
38+
39+
def get_delimiter():
40+
if sys.platform.startswith("win"):
41+
delimiter = ";"
42+
else:
43+
delimiter = ":"
44+
return delimiter
45+
3446

3547
added_data_options = []
3648
for src, dst in added_files:
37-
added_data_options += ["--add-data", f"{src}{delimiter}{dst}"]
49+
added_data_options += ["--add-data", f"{src}{get_delimiter()}{dst}"]
3850
pack_options_unpacked = [item for pair in pack_options for item in pair]
3951

4052

0 commit comments

Comments
 (0)