فهرست منبع

Merge pull request #11778 from touilleMan/gdnative-add-library-path-to-init-options

[GDnative] add library path to init options
Thomas Herzog 8 سال پیش
والد
کامیت
cf17b081f1
2فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 2 0
      modules/gdnative/gdnative.cpp
  2. 1 0
      modules/gdnative/include/gdnative/gdnative.h

+ 2 - 0
modules/gdnative/gdnative.cpp

@@ -110,6 +110,7 @@ GDNativeLibrary::~GDNativeLibrary() {
 void GDNativeLibrary::_bind_methods() {
 	ClassDB::bind_method(D_METHOD("set_library_path", "platform", "path"), &GDNativeLibrary::set_library_path);
 	ClassDB::bind_method(D_METHOD("get_library_path", "platform"), &GDNativeLibrary::get_library_path);
+	ClassDB::bind_method(D_METHOD("get_active_library_path"), &GDNativeLibrary::get_active_library_path);
 
 	ClassDB::bind_method(D_METHOD("is_singleton_gdnative"), &GDNativeLibrary::is_singleton_gdnative);
 	ClassDB::bind_method(D_METHOD("set_singleton_gdnative", "singleton"), &GDNativeLibrary::set_singleton_gdnative);
@@ -268,6 +269,7 @@ bool GDNative::initialize() {
 	options.editor_api_hash = ClassDB::get_api_hash(ClassDB::API_EDITOR);
 	options.no_api_hash = ClassDB::get_api_hash(ClassDB::API_NONE);
 	options.gd_native_library = (godot_object *)(get_library().ptr());
+	options.active_library_path = (godot_string *)&path;
 
 	library_init_fpointer(&options);
 

+ 1 - 0
modules/gdnative/include/gdnative/gdnative.h

@@ -243,6 +243,7 @@ typedef struct {
 	uint64_t no_api_hash;
 	godot_object *gd_native_library; // pointer to GDNativeLibrary that is being initialized
 	const struct godot_gdnative_api_struct *api_struct;
+	const godot_string *active_library_path;
 } godot_gdnative_init_options;
 
 typedef struct {