Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 8749fa0

Browse files
authored
Merge pull request #1752 from janhq/dev
Sync dev to main 1.0.4-rc4
2 parents 287123e + 104ed76 commit 8749fa0

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

engine/migrations/migration_helper.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ cpp::result<bool, std::string> MigrationHelper::BackupDatabase(
77
try {
88
SQLite::Database src_db(src_db_path, SQLite::OPEN_READONLY);
99
sqlite3* backup_db;
10-
11-
if (sqlite3_open16(backup_db_path.c_str(), &backup_db) != SQLITE_OK) {
10+
11+
if (sqlite3_open(backup_db_path.c_str(), &backup_db) != SQLITE_OK) {
1212
throw std::runtime_error("Failed to open backup database");
1313
}
1414

engine/migrations/migration_manager.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "schema_version.h"
55
#include "utils/file_manager_utils.h"
66
#include "utils/scope_exit.h"
7+
#include "utils/widechar_conv.h"
78

89
namespace cortex::migr {
910

@@ -40,7 +41,13 @@ cpp::result<bool, std::string> MigrationManager::Migrate() {
4041
if (std::filesystem::exists(fmu::GetCortexDataPath() / kCortexDb)) {
4142
auto src_db_path = (fmu::GetCortexDataPath() / kCortexDb);
4243
auto backup_db_path = (fmu::GetCortexDataPath() / kCortexDbBackup);
43-
if (auto res = mgr_helper_.BackupDatabase(src_db_path, backup_db_path.string());
44+
#if defined(_WIN32)
45+
if (auto res = mgr_helper_.BackupDatabase(
46+
src_db_path, cortex::wc::WstringToUtf8(backup_db_path.wstring()));
47+
#else
48+
if (auto res =
49+
mgr_helper_.BackupDatabase(src_db_path, backup_db_path.string());
50+
#endif
4451
res.has_error()) {
4552
CTL_INF("Error: backup database failed!");
4653
return res;

0 commit comments

Comments
 (0)