mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-01 21:14:43 -05:00
Configuration for RPC urls and Bitcoin wallet name
This commit is contained in:
parent
9eae0db9ac
commit
802dc61e7e
18 changed files with 779 additions and 442 deletions
|
|
@ -1,4 +1,26 @@
|
|||
use std::path::Path;
|
||||
use anyhow::Context;
|
||||
use directories_next::ProjectDirs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// This is to store the configuration and seed files
|
||||
// Linux: /home/<user>/.config/xmr-btc-swap/
|
||||
// OSX: /Users/<user>/Library/Preferences/xmr-btc-swap/
|
||||
fn default_config_dir() -> Option<PathBuf> {
|
||||
ProjectDirs::from("", "", "xmr-btc-swap").map(|proj_dirs| proj_dirs.config_dir().to_path_buf())
|
||||
}
|
||||
|
||||
pub fn default_config_path() -> anyhow::Result<PathBuf> {
|
||||
default_config_dir()
|
||||
.map(|dir| Path::join(&dir, "config.toml"))
|
||||
.context("Could not generate default configuration path")
|
||||
}
|
||||
|
||||
/// This is to store the DB
|
||||
// Linux: /home/<user>/.local/share/nectar/
|
||||
// OSX: /Users/<user>/Library/Application Support/nectar/
|
||||
pub fn default_data_dir() -> Option<std::path::PathBuf> {
|
||||
ProjectDirs::from("", "", "nectar").map(|proj_dirs| proj_dirs.data_dir().to_path_buf())
|
||||
}
|
||||
|
||||
pub fn ensure_directory_exists(file: &Path) -> Result<(), std::io::Error> {
|
||||
if let Some(path) = file.parent() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue