Skip to content

Commit

Permalink
refactor: remove sqlite dir path back-and-forth conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
furszy committed Feb 14, 2025
1 parent 21a0efa commit 5769481
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/wallet/sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ Mutex SQLiteDatabase::g_sqlite_mutex;
int SQLiteDatabase::g_sqlite_count = 0;

SQLiteDatabase::SQLiteDatabase(const fs::path& dir_path, const fs::path& file_path, const DatabaseOptions& options, bool mock)
: WalletDatabase(), m_mock(mock), m_dir_path(fs::PathToString(dir_path)), m_file_path(fs::PathToString(file_path)), m_write_semaphore(1), m_use_unsafe_sync(options.use_unsafe_sync)
: WalletDatabase(), m_mock(mock), m_dir_path(dir_path), m_file_path(fs::PathToString(file_path)), m_write_semaphore(1), m_use_unsafe_sync(options.use_unsafe_sync)
{
{
LOCK(g_sqlite_mutex);
LogPrintf("Using SQLite Version %s\n", SQLiteDatabaseVersion());
LogPrintf("Using wallet %s\n", m_dir_path);
LogPrintf("Using wallet %s\n", fs::PathToString(m_dir_path));

if (++g_sqlite_count == 1) {
// Setup logging
Expand Down Expand Up @@ -253,7 +253,7 @@ void SQLiteDatabase::Open()

if (m_db == nullptr) {
if (!m_mock) {
TryCreateDirectories(fs::PathFromString(m_dir_path));
TryCreateDirectories(m_dir_path);
}
int ret = sqlite3_open_v2(m_file_path.c_str(), &m_db, flags, nullptr);
if (ret != SQLITE_OK) {
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/sqlite.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class SQLiteDatabase : public WalletDatabase
private:
const bool m_mock{false};

const std::string m_dir_path;
const fs::path m_dir_path;

const std::string m_file_path;

Expand Down

0 comments on commit 5769481

Please sign in to comment.