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 reqwest::Client;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
use std::fs::Metadata;
|
use std::os::windows::fs::MetadataExt;
|
||||||
use std::{
|
use std::{
|
||||||
path::Path,
|
path::Path,
|
||||||
sync::{Arc, Mutex},
|
sync::{Arc, Mutex},
|
||||||
|
@ -414,13 +414,17 @@ impl PrivNodeApi {
|
||||||
.await?
|
.await?
|
||||||
.json::<PrivNodeApi>()
|
.json::<PrivNodeApi>()
|
||||||
.await?;
|
.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.
|
// 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
|
// https://github.com/monero-project/monero/issues/9513
|
||||||
{
|
{
|
||||||
private.result.database_size = std::fs::metadata(state.path_db)
|
if let Ok(metadata) = std::fs::metadata(if !state.path_db.is_empty() {
|
||||||
.unwrap_or(".bitmonero")
|
state.path_db.clone()
|
||||||
.st_size();
|
} else {
|
||||||
|
".bitmonero".to_string()
|
||||||
|
}) {
|
||||||
|
private.result.database_size = metadata.file_size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(private)
|
Ok(private)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue