Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion swap-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2024"

[dependencies]
anyhow = { workspace = true }
dirs = "6.0"
directories-next = "2"
tracing = { workspace = true }

[lints]
Expand Down
13 changes: 7 additions & 6 deletions swap-fs/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
use anyhow::{Context, Result};
use directories_next::ProjectDirs;
use std::path::{Path, PathBuf};

/// This is the default location for the overall config-dir specific by system
// Linux: /home/<user>/.config/xmr-btc-swap/
// OSX: /Users/<user>/Library/Application Support/xmr-btc-swap/
pub fn system_config_dir() -> Result<PathBuf> {
dirs::config_dir()
.map(|cd| cd.join("xmr-btc-swap"))
ProjectDirs::from("", "", "xmr-btc-swap")
.map(|proj_dirs| proj_dirs.config_dir().to_path_buf())
.context("Could not generate default system configuration dir path")
}

/// This is the default location for the overall data-dir specific by system
// Linux: /home/<user>/.local/share/xmr-btc-swap/
// OSX: /Users/<user>/Library/Application Support/xmr-btc-swap/
pub fn system_data_dir() -> Result<PathBuf> {
dirs::data_dir()
.map(|cd| cd.join("xmr-btc-swap"))
ProjectDirs::from("", "", "xmr-btc-swap")
.map(|proj_dirs| proj_dirs.data_dir().to_path_buf())
.context("Could not generate default system data-dir dir path")
}

Expand All @@ -25,8 +26,8 @@ pub fn system_data_dir_eigenwallet(testnet: bool) -> Result<PathBuf> {
false => "eigenwallet",
};

dirs::data_dir()
.map(|cd| cd.join(application_directory))
ProjectDirs::from("", "", application_directory)
.map(|proj_dirs| proj_dirs.data_dir().to_path_buf())
.context("Could not generate default system data-dir dir path")
}

Expand Down