mirror of
https://github.com/Cyrix126/gupaxx.git
synced 2024-12-22 14:49:21 +00:00
fix: 0B Node database size Windows
This commit is contained in:
parent
0126a917c7
commit
7b87940425
1 changed files with 9 additions and 5 deletions
|
@ -4,7 +4,7 @@ use readable::byte::Byte;
|
|||
use reqwest::Client;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::fs::Metadata;
|
||||
use std::os::windows::fs::MetadataExt;
|
||||
use std::{
|
||||
path::Path,
|
||||
sync::{Arc, Mutex},
|
||||
|
@ -414,13 +414,17 @@ impl PrivNodeApi {
|
|||
.await?
|
||||
.json::<PrivNodeApi>()
|
||||
.await?;
|
||||
#[cfg(target_os = "windows")]
|
||||
// #[cfg(target_os = "windows")]
|
||||
// api returns 0 for DB size for Windows so we read the size directly from the filesystem.
|
||||
// https://github.com/monero-project/monero/issues/9513
|
||||
{
|
||||
private.result.database_size = std::fs::metadata(state.path_db)
|
||||
.unwrap_or(".bitmonero")
|
||||
.st_size();
|
||||
if let Ok(metadata) = std::fs::metadata(if !state.path_db.is_empty() {
|
||||
state.path_db.clone()
|
||||
} else {
|
||||
".bitmonero".to_string()
|
||||
}) {
|
||||
private.result.database_size = metadata.file_size();
|
||||
}
|
||||
}
|
||||
Ok(private)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue