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

Remap script path when registering class. #41025

Merged
merged 1 commit into from
Aug 11, 2020
Merged
Changes from all commits
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
3 changes: 2 additions & 1 deletion core/script_language.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "core/core_string_names.h"
#include "core/debugger/engine_debugger.h"
#include "core/debugger/script_debugger.h"
#include "core/io/resource_loader.h"
#include "core/os/file_access.h"
#include "core/project_settings.h"

Expand Down Expand Up @@ -163,7 +164,7 @@ void ScriptServer::init_languages() {

for (int i = 0; i < script_classes.size(); i++) {
Dictionary c = script_classes[i];
if (!c.has("class") || !c.has("language") || !c.has("path") || !FileAccess::exists(c["path"]) || !c.has("base")) {
if (!c.has("class") || !c.has("language") || !c.has("path") || !FileAccess::exists(ResourceLoader::path_remap(c["path"])) || !c.has("base")) {
Copy link
Contributor

@Xrayez Xrayez Aug 4, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would FileAccess::exists work in exported project anyways? May be it's better to omit the check in tools=no builds altogether?

EDIT: works, but I'm curious why? FileAccess works on pck files? 👀

EDIT2: yes:

bool FileAccess::exists(const String &p_name) {
if (PackedData::get_singleton() && PackedData::get_singleton()->has_path(p_name)) {
return true;
}

continue;
}
add_global_class(c["class"], c["base"], c["language"], c["path"]);
Expand Down