GDExtension: Use loader to check if the library exists.
This commit is contained in:
parent
1fc8208765
commit
8a41b1d90f
4 changed files with 8 additions and 1 deletions
|
@ -259,6 +259,10 @@ bool GDExtensionLibraryLoader::has_library_changed() const {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool GDExtensionLibraryLoader::library_exists() const {
|
||||
return FileAccess::exists(resource_path);
|
||||
}
|
||||
|
||||
Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
|
||||
resource_path = p_path;
|
||||
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
virtual void close_library() override;
|
||||
virtual bool is_library_open() const override;
|
||||
virtual bool has_library_changed() const override;
|
||||
virtual bool library_exists() const override;
|
||||
|
||||
Error parse_gdextension_file(const String &p_path);
|
||||
};
|
||||
|
|
|
@ -42,6 +42,7 @@ public:
|
|||
virtual void close_library() = 0;
|
||||
virtual bool is_library_open() const = 0;
|
||||
virtual bool has_library_changed() const = 0;
|
||||
virtual bool library_exists() const = 0;
|
||||
};
|
||||
|
||||
#endif // GDEXTENSION_LOADER_H
|
||||
|
|
|
@ -302,7 +302,8 @@ bool GDExtensionManager::ensure_extensions_loaded(const HashSet<String> &p_exten
|
|||
for (const String &loaded_extension : loaded_extensions) {
|
||||
if (!p_extensions.has(loaded_extension)) {
|
||||
// The extension may not have a .gdextension file.
|
||||
if (!FileAccess::exists(loaded_extension)) {
|
||||
const Ref<GDExtension> extension = GDExtensionManager::get_singleton()->get_extension(loaded_extension);
|
||||
if (!extension->get_loader()->library_exists()) {
|
||||
extensions_removed.push_back(loaded_extension);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue