Skip to content

Commit

Permalink
Merge pull request godotengine#28954 from bruvzg/macos_user_icns
Browse files Browse the repository at this point in the history
Allow using user provided `.icns` files for exported app icons.
  • Loading branch information
akien-mga authored May 17, 2019
2 parents b963bf8 + 22ee268 commit 40a5f81
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions platform/osx/export/export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ void EditorExportPlatformOSX::get_export_options(List<ExportOption> *r_options)

r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/name", PROPERTY_HINT_PLACEHOLDER_TEXT, "Game Name"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/info"), "Made with Godot Engine"));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/icon", PROPERTY_HINT_FILE, "*.png,*.icns"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/identifier", PROPERTY_HINT_PLACEHOLDER_TEXT, "com.example.game"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/signature"), ""));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/short_version"), "1.0"));
Expand Down Expand Up @@ -542,11 +542,21 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
iconpath = ProjectSettings::get_singleton()->get("application/config/icon");

if (iconpath != "") {
Ref<Image> icon;
icon.instance();
icon->load(iconpath);
if (!icon->empty()) {
_make_icon(icon, data);
if (iconpath.get_extension() == "icns") {
FileAccess *icon = FileAccess::open(iconpath, FileAccess::READ);
if (icon) {
data.resize(icon->get_len());
icon->get_buffer(&data.write[0], icon->get_len());
icon->close();
memdelete(icon);
}
} else {
Ref<Image> icon;
icon.instance();
icon->load(iconpath);
if (!icon->empty()) {
_make_icon(icon, data);
}
}
}
//bleh?
Expand Down

0 comments on commit 40a5f81

Please sign in to comment.