Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate file exists for add_translation_from_resource #118

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions addons/mod_loader/mod_loader.gd
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,10 @@ func register_global_classes_from_array(new_global_classes: Array) -> void:
# file should have been created in Godot already: When you improt a CSV, such
# a file will be created for you.
func add_translation_from_resource(resource_path: String) -> void:
if not File.new().file_exists(resource_path):
ModLoaderUtils.log_fatal("Tried to load a translation resource from a file that doesn't exist. The invalid path was: %s" % [resource_path], CLOADER_LOG)
return
ithinkandicode marked this conversation as resolved.
Show resolved Hide resolved

var translation_object: Translation = load(resource_path)
TranslationServer.add_translation(translation_object)
ModLoaderUtils.log_info("Added Translation from Resource -> %s" % resource_path, LOG_NAME)
Expand Down