-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Fix #6209 - introduce standalone dir crate #7383
Conversation
nicolasochem
commented
Dec 26, 2017
- created the dir crate in util
- moved code from ethstore/src/dir/paths.rs to dir crate
- rename dir module in ethstore to accounts_dir to distinguish it from the dir crate
- rebase and include code review changes
It looks like @nicolasochem signed our Contributor License Agreement. 👍 Many thanks, Parity Technologies CLA Bot |
* created the dir crate in util * moved code from ethstore/src/dir/paths.rs to dir crate * rename dir module in ethstore to accounts_dir to distinguish it from the dir crate * changes after @tomusdrw on openethereum#6952
d030320
to
a8001ab
Compare
@tomusdrw please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Minor grumble regarding platform
module.
util/dir/src/lib.rs
Outdated
|
||
mod platform { | ||
use std::path::PathBuf; | ||
#[cfg(target_os = "macos")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean with platform
module is:
// re-export
pub use platform::*;
#[cfg(target_os = "macos")]
mod platform {
pub const CACHE_PATH: &'static str = "$BASE/cache";
pub fn parity_base() -> PathBuf { ... }
}
#[cfg(windows)]
mod platform {
pub const CACHE_PATH: &'static str = "$LOCAL/cache";
pub fn parity_base() -> PathBuf { ... }
}
So that you don't need to repeat those #[cfg(
statements for all methods, since it might be a bit confusing to understand what is exposed where.
@tomusdrw fixed, please check again |
util/dir/src/lib.rs
Outdated
@@ -28,6 +28,8 @@ use bigint::hash::{H64, H256}; | |||
use journaldb::Algorithm; | |||
use helpers::{replace_home, replace_home_and_local}; | |||
use app_dirs::{AppInfo, get_app_root, AppDataType}; | |||
// re-export platform-specific functions | |||
use platform::*; | |||
|
|||
#[cfg(target_os = "macos")] const AUTHOR: &'static str = "Parity"; | |||
#[cfg(target_os = "macos")] const PRODUCT: &'static str = "io.parity.ethereum"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to grumble again, would you mind moving this constants to platform
as well?
@tomusdrw please check again |
Looks perfect! 👍 |
standalone dir crate, replaces #7383