Skip to content

Commit

Permalink
fix: windows path default lmdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyrix126 committed Oct 11, 2024
1 parent 4b0f923 commit 0899026
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions src/helper/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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()]"
Expand Down Expand Up @@ -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")]
Expand All @@ -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();
}
Expand Down

0 comments on commit 0899026

Please sign in to comment.