Browse Source

Fix built-in script path of GDScript

Wei Guo 2 years ago
parent
commit
d0edd36f80
2 changed files with 6 additions and 0 deletions
  1. 5 0
      modules/gdscript/gdscript.cpp
  2. 1 0
      modules/gdscript/gdscript.h

+ 5 - 0
modules/gdscript/gdscript.cpp

@@ -1050,6 +1050,11 @@ Error GDScript::load_byte_code(const String &p_path) {
 	return ERR_COMPILATION_FAILED;
 	return ERR_COMPILATION_FAILED;
 }
 }
 
 
+void GDScript::set_path(const String &p_path, bool p_take_over) {
+	Script::set_path(p_path, p_take_over);
+	this->path = p_path;
+}
+
 Error GDScript::load_source_code(const String &p_path) {
 Error GDScript::load_source_code(const String &p_path) {
 	Vector<uint8_t> sourcef;
 	Vector<uint8_t> sourcef;
 	Error err;
 	Error err;

+ 1 - 0
modules/gdscript/gdscript.h

@@ -222,6 +222,7 @@ public:
 
 
 	virtual Error reload(bool p_keep_state = false) override;
 	virtual Error reload(bool p_keep_state = false) override;
 
 
+	virtual void set_path(const String &p_path, bool p_take_over = false) override;
 	void set_script_path(const String &p_path) { path = p_path; } //because subclasses need a path too...
 	void set_script_path(const String &p_path) { path = p_path; } //because subclasses need a path too...
 	Error load_source_code(const String &p_path);
 	Error load_source_code(const String &p_path);
 	Error load_byte_code(const String &p_path);
 	Error load_byte_code(const String &p_path);