From 346a0c99ba7726c2471699bf701fe2e9d60b5289 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Fri, 23 Feb 2024 09:36:53 +0100 Subject: [PATCH 1/7] add sqlite resourec --- src/resource_loader_sqlite.cpp | 23 +++++++++++++++++++++++ src/resource_loader_sqlite.h | 21 +++++++++++++++++++++ src/resource_sqlite.cpp | 11 +++++++++++ src/resource_sqlite.h | 29 +++++++++++++++++++++++++++++ 4 files changed, 84 insertions(+) create mode 100644 src/resource_loader_sqlite.cpp create mode 100644 src/resource_loader_sqlite.h create mode 100644 src/resource_sqlite.cpp create mode 100644 src/resource_sqlite.h diff --git a/src/resource_loader_sqlite.cpp b/src/resource_loader_sqlite.cpp new file mode 100644 index 00000000..fb40f899 --- /dev/null +++ b/src/resource_loader_sqlite.cpp @@ -0,0 +1,23 @@ +#include "resource_loader_sqlite.h" +#include "resource_sqlite.h" + +Variant ResourceFormatLoaderSqlite::_load(const String &p_path, const String &original_path, bool use_sub_threads, int32_t cache_mode) const { + Ref sqlite_model = memnew(SqliteResource); + sqlite_model->set_file(p_path); + return sqlite_model; +} +PackedStringArray ResourceFormatLoaderSqlite::_get_recognized_extensions() const { + PackedStringArray array; + array.push_back("bin"); + return array; +} +bool ResourceFormatLoaderSqlite::_handles_type(const StringName &type) const { + return ClassDB::is_parent_class(type, "SqliteResource"); +} +String ResourceFormatLoaderSqlite::_get_resource_type(const String &p_path) const { + String el = p_path.get_extension().to_lower(); + if (el == "sqlite") { + return "SqliteResource"; + } + return ""; +} diff --git a/src/resource_loader_sqlite.h b/src/resource_loader_sqlite.h new file mode 100644 index 00000000..cdcfbcf8 --- /dev/null +++ b/src/resource_loader_sqlite.h @@ -0,0 +1,21 @@ +#ifndef SQLITE_LOADER_SQLITE_H +#define SQLITE_LOADER_SQLITE_H + +#include +#include + +using namespace godot; + +class ResourceFormatLoaderSqlite : public ResourceFormatLoader { + GDCLASS(ResourceFormatLoaderSqlite, ResourceFormatLoader); + +protected: + static void _bind_methods() {} + +public: + virtual Variant _load(const String &path, const String &original_path, bool use_sub_threads, int32_t cache_mode) const override; + virtual PackedStringArray _get_recognized_extensions() const override; + virtual bool _handles_type(const StringName &type) const override; + virtual String _get_resource_type(const String &p_path) const override; +}; +#endif // SQLITE_LOADER_SQLITE_H diff --git a/src/resource_sqlite.cpp b/src/resource_sqlite.cpp new file mode 100644 index 00000000..1fc7bf23 --- /dev/null +++ b/src/resource_sqlite.cpp @@ -0,0 +1,11 @@ +#include "resource_sqlite.h" +#include + +#include + +PackedByteArray SqliteResource::get_content() { + PackedByteArray content; + String p_path = get_file(); + content = FileAccess::get_file_as_bytes(p_path); + return content; +} diff --git a/src/resource_sqlite.h b/src/resource_sqlite.h new file mode 100644 index 00000000..0fbb9fd2 --- /dev/null +++ b/src/resource_sqlite.h @@ -0,0 +1,29 @@ +#ifndef SQLITE_RESOURCE_H +#define SQLITE_RESOURCE_H + +#include + +using namespace godot; + +class SqliteResource : public Resource { + GDCLASS(SqliteResource, Resource); + +protected: + static void _bind_methods() {} + String file; + +public: + void set_file(const String &p_file) { + file = p_file; + emit_changed(); + } + + String get_file() { + return file; + } + + PackedByteArray get_content(); + SqliteResource() {} + ~SqliteResource() {} +}; +#endif // SQLITE_RESOURCE_H From cbc818f25d7fb09a6d91892832ea8740d76f5402 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Wed, 13 Mar 2024 10:46:11 +0100 Subject: [PATCH 2/7] update missing things. Update sample to use resource. --- demo/Main.tscn | 4 +++- demo/database.gd | 9 ++++----- demo/project.godot | 2 +- src/register_types.cpp | 11 +++++++++++ src/resource_loader_sqlite.cpp | 18 +++++++++--------- src/resource_loader_sqlite.h | 4 ++-- src/resource_sqlite.cpp | 2 +- src/resource_sqlite.h | 8 ++++---- 8 files changed, 35 insertions(+), 23 deletions(-) diff --git a/demo/Main.tscn b/demo/Main.tscn index 695d8896..8c247cd1 100644 --- a/demo/Main.tscn +++ b/demo/Main.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=4 format=3 uid="uid://dsba4ukrk2ymt"] +[gd_scene load_steps=5 format=3 uid="uid://dsba4ukrk2ymt"] [ext_resource type="Script" path="res://database.gd" id="1"] [ext_resource type="Script" path="res://Main.gd" id="2"] +[ext_resource type="SQLiteResource" path="res://data/test.db" id="3_onnij"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_45gfi"] content_margin_left = 24.0 @@ -21,6 +22,7 @@ script = ExtResource("2") [node name="Database" type="Node" parent="."] script = ExtResource("1") +db_resource = ExtResource("3_onnij") [node name="MarginContainer" type="MarginContainer" parent="."] layout_mode = 1 diff --git a/demo/database.gd b/demo/database.gd index cbd38f9d..81bab728 100644 --- a/demo/database.gd +++ b/demo/database.gd @@ -4,7 +4,7 @@ var db : SQLite = null const verbosity_level : int = SQLite.VERBOSE -var db_name := "res://data/test" +@export var db_resource : SQLiteResource var packaged_db_name := "res://data_to_be_packaged" var peristent_db_name := "user://my_database" var json_name := "res://data/test_backup" @@ -29,7 +29,6 @@ signal texture_received(texture) func _ready(): if OS.get_name() in ["Android", "iOS", "Web"]: copy_data_to_user() - db_name = "user://data/test" json_name = "user://data/test_backup" # Enable/disable examples here: @@ -77,7 +76,7 @@ func example_of_basic_database_querying(): table_dict["salary"] = {"data_type":"real"} db = SQLite.new() - db.path = db_name + db.path = db_resource.resource_name db.verbosity_level = verbosity_level # Open the database using the db_name found in the path variable db.open_db() @@ -249,7 +248,7 @@ func example_of_call_external_functions(): table_dict["salary"] = {"data_type":"real"} db = SQLite.new() - db.path = db_name + db.path = db_resource.resource_path db.verbosity_level = verbosity_level # Open the database using the db_name found in the path variable db.open_db() @@ -298,7 +297,7 @@ func example_of_blob_io(): var tex_data : PackedByteArray = texture.get_image().save_png_to_buffer() db = SQLite.new() - db.path = db_name + db.path = db_resource.resource_path db.verbosity_level = verbosity_level # Open the database using the db_name found in the path variable db.open_db() diff --git a/demo/project.godot b/demo/project.godot index a35a7844..1dd631ed 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -21,7 +21,7 @@ settings/stdout/verbose_stdout=true [editor_plugins] -enabled=PackedStringArray() +enabled=PackedStringArray("res://addons/godot-sqlite/plugin.cfg") [rendering] diff --git a/src/register_types.cpp b/src/register_types.cpp index 9601f4ba..75cae615 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -7,21 +7,32 @@ #include #include "gdsqlite.h" +#include "resource_loader_sqlite.h" +#include "resource_sqlite.h" using namespace godot; +static Ref sqlite_loader; + void initialize_sqlite_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return; } ClassDB::register_class(); + GDREGISTER_CLASS(ResourceFormatLoaderSQLite); + GDREGISTER_CLASS(SQLiteResource); + + sqlite_loader.instantiate(); + ResourceLoader::get_singleton()->add_resource_format_loader(sqlite_loader); } void uninitialize_sqlite_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return; } + ResourceLoader::get_singleton()->remove_resource_format_loader(sqlite_loader); + sqlite_loader.unref(); } extern "C" { diff --git a/src/resource_loader_sqlite.cpp b/src/resource_loader_sqlite.cpp index fb40f899..97d99d64 100644 --- a/src/resource_loader_sqlite.cpp +++ b/src/resource_loader_sqlite.cpp @@ -1,23 +1,23 @@ #include "resource_loader_sqlite.h" #include "resource_sqlite.h" -Variant ResourceFormatLoaderSqlite::_load(const String &p_path, const String &original_path, bool use_sub_threads, int32_t cache_mode) const { - Ref sqlite_model = memnew(SqliteResource); +Variant ResourceFormatLoaderSQLite::_load(const String &p_path, const String &original_path, bool use_sub_threads, int32_t cache_mode) const { + Ref sqlite_model = memnew(SQLiteResource); sqlite_model->set_file(p_path); return sqlite_model; } -PackedStringArray ResourceFormatLoaderSqlite::_get_recognized_extensions() const { +PackedStringArray ResourceFormatLoaderSQLite::_get_recognized_extensions() const { PackedStringArray array; - array.push_back("bin"); + array.push_back("db"); return array; } -bool ResourceFormatLoaderSqlite::_handles_type(const StringName &type) const { - return ClassDB::is_parent_class(type, "SqliteResource"); +bool ResourceFormatLoaderSQLite::_handles_type(const StringName &type) const { + return ClassDB::is_parent_class(type, "SQLiteResource"); } -String ResourceFormatLoaderSqlite::_get_resource_type(const String &p_path) const { +String ResourceFormatLoaderSQLite::_get_resource_type(const String &p_path) const { String el = p_path.get_extension().to_lower(); - if (el == "sqlite") { - return "SqliteResource"; + if (el == "db") { + return "SQLiteResource"; } return ""; } diff --git a/src/resource_loader_sqlite.h b/src/resource_loader_sqlite.h index cdcfbcf8..71d73b04 100644 --- a/src/resource_loader_sqlite.h +++ b/src/resource_loader_sqlite.h @@ -6,8 +6,8 @@ using namespace godot; -class ResourceFormatLoaderSqlite : public ResourceFormatLoader { - GDCLASS(ResourceFormatLoaderSqlite, ResourceFormatLoader); +class ResourceFormatLoaderSQLite : public ResourceFormatLoader { + GDCLASS(ResourceFormatLoaderSQLite, ResourceFormatLoader); protected: static void _bind_methods() {} diff --git a/src/resource_sqlite.cpp b/src/resource_sqlite.cpp index 1fc7bf23..93ad94bf 100644 --- a/src/resource_sqlite.cpp +++ b/src/resource_sqlite.cpp @@ -3,7 +3,7 @@ #include -PackedByteArray SqliteResource::get_content() { +PackedByteArray SQLiteResource::get_content() { PackedByteArray content; String p_path = get_file(); content = FileAccess::get_file_as_bytes(p_path); diff --git a/src/resource_sqlite.h b/src/resource_sqlite.h index 0fbb9fd2..20147301 100644 --- a/src/resource_sqlite.h +++ b/src/resource_sqlite.h @@ -5,8 +5,8 @@ using namespace godot; -class SqliteResource : public Resource { - GDCLASS(SqliteResource, Resource); +class SQLiteResource : public Resource { + GDCLASS(SQLiteResource, Resource); protected: static void _bind_methods() {} @@ -23,7 +23,7 @@ class SqliteResource : public Resource { } PackedByteArray get_content(); - SqliteResource() {} - ~SqliteResource() {} + SQLiteResource() {} + ~SQLiteResource() {} }; #endif // SQLITE_RESOURCE_H From fc29c3ef1393735771ffbae4665d879775f3f460 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Thu, 14 Mar 2024 10:01:10 +0100 Subject: [PATCH 3/7] Update register_types.cpp --- src/register_types.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/register_types.cpp b/src/register_types.cpp index 75cae615..38de6196 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "gdsqlite.h" #include "resource_loader_sqlite.h" @@ -14,17 +15,43 @@ using namespace godot; static Ref sqlite_loader; +void register_setting( + const String &p_name, + const Variant &p_value, + PropertyHint p_hint, + const String &p_hint_string, + bool restart_if_changed) { + ProjectSettings *project_settings = ProjectSettings::get_singleton(); + + if (!project_settings->has_setting(p_name)) { + project_settings->set(p_name, p_value); + } + + Dictionary property_info; + property_info["name"] = p_name; + property_info["type"] = p_value.get_type(); + property_info["hint"] = p_hint; + property_info["hint_string"] = p_hint_string; + + project_settings->add_property_info(property_info); + project_settings->set_initial_value(p_name, p_value); + project_settings->set_restart_if_changed(p_name, true); +} + void initialize_sqlite_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { return; } - ClassDB::register_class(); + GDREGISTER_CLASS(SQLite); GDREGISTER_CLASS(ResourceFormatLoaderSQLite); GDREGISTER_CLASS(SQLiteResource); sqlite_loader.instantiate(); ResourceLoader::get_singleton()->add_resource_format_loader(sqlite_loader); + PackedStringArray array; + array.push_back("db"); + register_setting("filesystem/import/sqlite/default_extension", array, PROPERTY_HINT_NONE, {}, true); } void uninitialize_sqlite_module(ModuleInitializationLevel p_level) { From d8f8fa5b9f281149ec6cedcba1045d6e725cd43d Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Thu, 14 Mar 2024 10:03:58 +0100 Subject: [PATCH 4/7] Update resource_loader_sqlite.cpp --- src/resource_loader_sqlite.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/resource_loader_sqlite.cpp b/src/resource_loader_sqlite.cpp index 97d99d64..b3cbc9d0 100644 --- a/src/resource_loader_sqlite.cpp +++ b/src/resource_loader_sqlite.cpp @@ -1,5 +1,8 @@ #include "resource_loader_sqlite.h" #include "resource_sqlite.h" +#include + +using namespace godot; Variant ResourceFormatLoaderSQLite::_load(const String &p_path, const String &original_path, bool use_sub_threads, int32_t cache_mode) const { Ref sqlite_model = memnew(SQLiteResource); @@ -7,17 +10,17 @@ Variant ResourceFormatLoaderSQLite::_load(const String &p_path, const String &or return sqlite_model; } PackedStringArray ResourceFormatLoaderSQLite::_get_recognized_extensions() const { - PackedStringArray array; - array.push_back("db"); - return array; + return ProjectSettings::get_singleton()->get("filesystem/import/sqlite/default_extension"); } bool ResourceFormatLoaderSQLite::_handles_type(const StringName &type) const { return ClassDB::is_parent_class(type, "SQLiteResource"); } String ResourceFormatLoaderSQLite::_get_resource_type(const String &p_path) const { String el = p_path.get_extension().to_lower(); - if (el == "db") { - return "SQLiteResource"; + for (String element : (PackedStringArray)ProjectSettings::get_singleton()->get("filesystem/import/sqlite/default_extension")) { + if (el == element) { + return "SQLiteResource"; + } } return ""; } From aa7207f20cb632fe5f315d92367420e0c6e7177a Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Thu, 14 Mar 2024 10:12:33 +0100 Subject: [PATCH 5/7] lint --- src/register_types.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/register_types.cpp b/src/register_types.cpp index 38de6196..433e61ea 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -2,10 +2,10 @@ #include +#include #include #include #include -#include #include "gdsqlite.h" #include "resource_loader_sqlite.h" @@ -20,7 +20,7 @@ void register_setting( const Variant &p_value, PropertyHint p_hint, const String &p_hint_string, - bool restart_if_changed) { + bool restart_if_changed) { ProjectSettings *project_settings = ProjectSettings::get_singleton(); if (!project_settings->has_setting(p_name)) { @@ -35,7 +35,7 @@ void register_setting( project_settings->add_property_info(property_info); project_settings->set_initial_value(p_name, p_value); - project_settings->set_restart_if_changed(p_name, true); + project_settings->set_restart_if_changed(p_name, true); } void initialize_sqlite_module(ModuleInitializationLevel p_level) { @@ -49,7 +49,7 @@ void initialize_sqlite_module(ModuleInitializationLevel p_level) { sqlite_loader.instantiate(); ResourceLoader::get_singleton()->add_resource_format_loader(sqlite_loader); - PackedStringArray array; + PackedStringArray array; array.push_back("db"); register_setting("filesystem/import/sqlite/default_extension", array, PROPERTY_HINT_NONE, {}, true); } From f4ed34e3f5424079b003c89dbfb6d2219f973e9a Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sat, 6 Apr 2024 23:25:10 +0200 Subject: [PATCH 6/7] update feedback. --- SConstruct | 4 +- demo/database.gd | 2 +- src/register_types.cpp | 42 +++++++------------ src/{ => resource}/resource_loader_sqlite.cpp | 0 src/{ => resource}/resource_loader_sqlite.h | 0 src/resource/resource_sqlite.cpp | 14 +++++++ src/{ => resource}/resource_sqlite.h | 14 +------ src/resource_sqlite.cpp | 11 ----- 8 files changed, 35 insertions(+), 52 deletions(-) rename src/{ => resource}/resource_loader_sqlite.cpp (100%) rename src/{ => resource}/resource_loader_sqlite.h (100%) create mode 100644 src/resource/resource_sqlite.cpp rename src/{ => resource}/resource_sqlite.h (60%) delete mode 100644 src/resource_sqlite.cpp diff --git a/SConstruct b/SConstruct index fca9ccba..35b515c1 100644 --- a/SConstruct +++ b/SConstruct @@ -21,7 +21,7 @@ target = "{}{}".format( # tweak this if you want to use different folders, or more folders, to store your source code in. env.Append(CPPPATH=["src/"]) -sources = [Glob('src/*.cpp'), Glob('src/vfs/*.cpp'), 'src/sqlite/sqlite3.c'] +sources = [Glob('src/*.cpp'), Glob('src/vfs/*.cpp'), Glob('src/resource/*.cpp'), 'src/sqlite/sqlite3.c'] if env["platform"] == "macos": target = "{}.{}.{}.framework/{}.{}.{}".format( @@ -40,4 +40,4 @@ else: ) library = env.SharedLibrary(target=target, source=sources) -Default(library) \ No newline at end of file +Default(library) diff --git a/demo/database.gd b/demo/database.gd index 81bab728..c5478802 100644 --- a/demo/database.gd +++ b/demo/database.gd @@ -76,7 +76,7 @@ func example_of_basic_database_querying(): table_dict["salary"] = {"data_type":"real"} db = SQLite.new() - db.path = db_resource.resource_name + db.path = db_resource.resource_path db.verbosity_level = verbosity_level # Open the database using the db_name found in the path variable db.open_db() diff --git a/src/register_types.cpp b/src/register_types.cpp index 433e61ea..9c639ac3 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -8,35 +8,13 @@ #include #include "gdsqlite.h" -#include "resource_loader_sqlite.h" -#include "resource_sqlite.h" +#include "resource/resource_loader_sqlite.h" +#include "resource/resource_sqlite.h" using namespace godot; static Ref sqlite_loader; - -void register_setting( - const String &p_name, - const Variant &p_value, - PropertyHint p_hint, - const String &p_hint_string, - bool restart_if_changed) { - ProjectSettings *project_settings = ProjectSettings::get_singleton(); - - if (!project_settings->has_setting(p_name)) { - project_settings->set(p_name, p_value); - } - - Dictionary property_info; - property_info["name"] = p_name; - property_info["type"] = p_value.get_type(); - property_info["hint"] = p_hint; - property_info["hint_string"] = p_hint_string; - - project_settings->add_property_info(property_info); - project_settings->set_initial_value(p_name, p_value); - project_settings->set_restart_if_changed(p_name, true); -} +const char * DEFAULT_DB_NAME = "filesystem/import/sqlite/default_extension"; void initialize_sqlite_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { @@ -51,7 +29,19 @@ void initialize_sqlite_module(ModuleInitializationLevel p_level) { ResourceLoader::get_singleton()->add_resource_format_loader(sqlite_loader); PackedStringArray array; array.push_back("db"); - register_setting("filesystem/import/sqlite/default_extension", array, PROPERTY_HINT_NONE, {}, true); + + ProjectSettings *project_settings = ProjectSettings::get_singleton(); + + if (!project_settings->has_setting(DEFAULT_DB_NAME)) { + project_settings->set(DEFAULT_DB_NAME, ""); + } + + Dictionary property_info; + property_info["name"] = DEFAULT_DB_NAME; + property_info["type"] = godot::Variant::Type::STRING; + + project_settings->add_property_info(property_info); + project_settings->set_initial_value(DEFAULT_DB_NAME, "db"); } void uninitialize_sqlite_module(ModuleInitializationLevel p_level) { diff --git a/src/resource_loader_sqlite.cpp b/src/resource/resource_loader_sqlite.cpp similarity index 100% rename from src/resource_loader_sqlite.cpp rename to src/resource/resource_loader_sqlite.cpp diff --git a/src/resource_loader_sqlite.h b/src/resource/resource_loader_sqlite.h similarity index 100% rename from src/resource_loader_sqlite.h rename to src/resource/resource_loader_sqlite.h diff --git a/src/resource/resource_sqlite.cpp b/src/resource/resource_sqlite.cpp new file mode 100644 index 00000000..191881e6 --- /dev/null +++ b/src/resource/resource_sqlite.cpp @@ -0,0 +1,14 @@ +#include "resource_sqlite.h" +#include + +#include + + +void SQLiteResource::set_file(const String &p_file) { + file = p_file; + emit_changed(); +} + +String SQLiteResource::get_file() { + return file; +} diff --git a/src/resource_sqlite.h b/src/resource/resource_sqlite.h similarity index 60% rename from src/resource_sqlite.h rename to src/resource/resource_sqlite.h index 20147301..356a0e7d 100644 --- a/src/resource_sqlite.h +++ b/src/resource/resource_sqlite.h @@ -13,17 +13,7 @@ class SQLiteResource : public Resource { String file; public: - void set_file(const String &p_file) { - file = p_file; - emit_changed(); - } - - String get_file() { - return file; - } - - PackedByteArray get_content(); - SQLiteResource() {} - ~SQLiteResource() {} + void set_file(const String &p_file); + String get_file(); }; #endif // SQLITE_RESOURCE_H diff --git a/src/resource_sqlite.cpp b/src/resource_sqlite.cpp deleted file mode 100644 index 93ad94bf..00000000 --- a/src/resource_sqlite.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "resource_sqlite.h" -#include - -#include - -PackedByteArray SQLiteResource::get_content() { - PackedByteArray content; - String p_path = get_file(); - content = FileAccess::get_file_as_bytes(p_path); - return content; -} From c13ad138626c2aeb1965d9ad0cfe47d03612ecf7 Mon Sep 17 00:00:00 2001 From: Dragos Daian Date: Sun, 7 Apr 2024 10:36:19 +0200 Subject: [PATCH 7/7] lint --- src/register_types.cpp | 6 +++--- src/resource/resource_sqlite.cpp | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/register_types.cpp b/src/register_types.cpp index 9c639ac3..29076393 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -14,7 +14,7 @@ using namespace godot; static Ref sqlite_loader; -const char * DEFAULT_DB_NAME = "filesystem/import/sqlite/default_extension"; +const char *DEFAULT_DB_NAME = "filesystem/import/sqlite/default_extension"; void initialize_sqlite_module(ModuleInitializationLevel p_level) { if (p_level != MODULE_INITIALIZATION_LEVEL_SCENE) { @@ -29,9 +29,9 @@ void initialize_sqlite_module(ModuleInitializationLevel p_level) { ResourceLoader::get_singleton()->add_resource_format_loader(sqlite_loader); PackedStringArray array; array.push_back("db"); - + ProjectSettings *project_settings = ProjectSettings::get_singleton(); - + if (!project_settings->has_setting(DEFAULT_DB_NAME)) { project_settings->set(DEFAULT_DB_NAME, ""); } diff --git a/src/resource/resource_sqlite.cpp b/src/resource/resource_sqlite.cpp index 191881e6..d22ef0c0 100644 --- a/src/resource/resource_sqlite.cpp +++ b/src/resource/resource_sqlite.cpp @@ -3,7 +3,6 @@ #include - void SQLiteResource::set_file(const String &p_file) { file = p_file; emit_changed();