-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from joshuafolkken/156-export-custom-manifest
export custom manifest - add maskable purpose for android #156
- Loading branch information
Showing
6 changed files
with
89 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,8 @@ | |
.godot/ | ||
android/ | ||
|
||
addons/ | ||
addons/* | ||
!addons/export_custom_manifest/ | ||
reports/ | ||
.DS_Store | ||
export/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
class_name ExportCustomManifest | ||
extends EditorExportPlugin | ||
|
||
const MANIFEST_FILENAME := "manifest.json" | ||
const MANIFEST_PATH = "res://web/" + MANIFEST_FILENAME | ||
|
||
var _features: PackedStringArray | ||
var _export_dir: String | ||
|
||
|
||
func _get_name() -> String: | ||
return "ExportCustomManifest" | ||
|
||
|
||
func copy_manifest(dest_path: String) -> void: | ||
var error := DirAccess.copy_absolute(MANIFEST_PATH, dest_path) | ||
|
||
if error != OK: | ||
push_error( | ||
( | ||
"Failed to copy manifest. Error code: %d\nSource: %s\nDestination: %s" | ||
% [error, MANIFEST_PATH, dest_path] | ||
) | ||
) | ||
else: | ||
print("Custom manifest.json copied successfully to: %s" % dest_path) | ||
|
||
|
||
func _export_begin(features: PackedStringArray, _is_debug: bool, path: String, _flags: int) -> void: | ||
_features = features | ||
_export_dir = path.get_base_dir() | ||
|
||
|
||
func _export_end() -> void: | ||
if "web" not in _features: | ||
return | ||
|
||
var dest_manifest_path := _export_dir.path_join("index." + MANIFEST_FILENAME) | ||
|
||
copy_manifest(dest_manifest_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[plugin] | ||
|
||
name="Export Custom Manifest" | ||
description="" | ||
author="Joshua Folkken" | ||
version="1.0.0" | ||
script="plugin.gd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
@tool | ||
extends EditorPlugin | ||
|
||
var export_plugin: EditorExportPlugin | ||
|
||
|
||
func _enter_tree() -> void: | ||
export_plugin = ExportCustomManifest.new() | ||
add_export_plugin(export_plugin) | ||
|
||
|
||
func _exit_tree() -> void: | ||
remove_export_plugin(export_plugin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"background_color": "#000000", | ||
"display": "fullscreen", | ||
"icons": [ | ||
{ | ||
"sizes": "144x144", | ||
"src": "index.144x144.png", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"sizes": "180x180", | ||
"src": "index.180x180.png", | ||
"type": "image/png" | ||
}, | ||
{ | ||
"sizes": "512x512", | ||
"src": "index.512x512.png", | ||
"type": "image/png", | ||
"purpose": "any maskable" | ||
} | ||
], | ||
"name": "Tic Tac Toe", | ||
"orientation": "landscape", | ||
"start_url": "./index.html" | ||
} |