@op-engineering/op-sqlite 11.2.6 → 11.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cpp/DBHostObject.cpp +16 -13
- package/package.json +1 -1
package/cpp/DBHostObject.cpp
CHANGED
|
@@ -738,19 +738,22 @@ void DBHostObject::create_jsi_functions() {
|
|
|
738
738
|
|
|
739
739
|
function_map["getDbPath"] = HOSTFN("getDbPath") {
|
|
740
740
|
std::string path = std::string(base_path);
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
741
|
+
|
|
742
|
+
if (count == 1) {
|
|
743
|
+
if(!args[0].isString()) {
|
|
744
|
+
throw std::runtime_error(
|
|
745
|
+
"[op-sqlite][open] database location must be a string");
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
std::string last_path = args[0].asString(rt).utf8(rt);
|
|
749
|
+
|
|
750
|
+
if (last_path == ":memory:") {
|
|
751
|
+
path = ":memory:";
|
|
752
|
+
} else if (last_path.rfind('/', 0) == 0) {
|
|
753
|
+
path = last_path;
|
|
754
|
+
} else {
|
|
755
|
+
path = path + "/" + last_path;
|
|
756
|
+
}
|
|
754
757
|
}
|
|
755
758
|
|
|
756
759
|
auto result = opsqlite_get_db_path(db_name, path);
|