fix: windows path default lmdb

This commit is contained in:
Cyrix126 2024-10-11 20:25:01 +02:00
parent 4b0f923316
commit 0899026e91

View file

@ -5,8 +5,6 @@ use reqwest::Client;
use serde::{Deserialize, Serialize};
#[cfg(target_os = "windows")]
use std::os::windows::fs::MetadataExt;
#[cfg(target_os = "windows")]
use std::path::PathBuf;
use std::{
path::Path,
sync::{Arc, Mutex},
@ -268,11 +266,7 @@ impl Helper {
PubNodeApi::update_from_output(pub_api, &output_pub, start.elapsed());
// update data from api
debug!("Node Watchdog | Attempting HTTP API request...");
#[cfg(target_os = "windows")]
let rep = PrivNodeApi::request_api(&client, &state, path.clone()).await;
#[cfg(not(target_os = "windows"))]
let rep = PrivNodeApi::request_api(&client, &state).await;
match rep {
match PrivNodeApi::request_api(&client, &state).await {
Ok(priv_api) => {
debug!(
"Node Watchdog | HTTP API request OK, attempting [update_from_priv()]"
@ -402,7 +396,6 @@ impl PrivNodeApi {
async fn request_api(
client: &Client,
state: &Node,
#[cfg(target_os = "windows")] mut path: PathBuf,
) -> std::result::Result<Self, anyhow::Error> {
let adr = format!("http://{}:{}/json_rpc", state.api_ip, state.api_port);
#[cfg(target_os = "windows")]
@ -428,10 +421,7 @@ impl PrivNodeApi {
if let Ok(metadata) = std::fs::metadata(if !state.path_db.is_empty() {
state.path_db.clone()
} else {
// take full path of monerod witout binary and add db since it's the default.
path.pop();
path.push("db");
path.to_str().unwrap_or_default().to_string()
r#"C:\ProgramData\bitmonero\"#.to_string()
}) {
private.result.database_size = metadata.file_size();
}