diff --git a/Cargo.lock b/Cargo.lock index 47700e7e37..ae2887730e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -894,6 +894,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + [[package]] name = "dirs-sys" version = "0.3.6" @@ -905,6 +915,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users 0.4.0", + "winapi", +] + [[package]] name = "dissimilar" version = "1.0.3" @@ -2270,6 +2291,7 @@ dependencies = [ "clap 3.1.8", "colored", "datatest-stable", + "dirs-next", "evm-exec-utils", "hex", "move-abigen", diff --git a/language/tools/move-package/Cargo.toml b/language/tools/move-package/Cargo.toml index 763a1674f7..638e2418f5 100644 --- a/language/tools/move-package/Cargo.toml +++ b/language/tools/move-package/Cargo.toml @@ -23,6 +23,7 @@ regex = "1.1.9" ptree = "0.4.0" once_cell = "1.7.2" named-lock = "0.1.1" +dirs-next = "2.0.0" move-binary-format = { path = "../../move-binary-format" } move-compiler = { path = "../../move-compiler" } diff --git a/language/tools/move-package/src/source_package/manifest_parser.rs b/language/tools/move-package/src/source_package/manifest_parser.rs index c474e999f0..886c68754e 100644 --- a/language/tools/move-package/src/source_package/manifest_parser.rs +++ b/language/tools/move-package/src/source_package/manifest_parser.rs @@ -330,7 +330,10 @@ fn parse_dependency(tval: TV) -> Result { let move_home = std::env::var("MOVE_HOME").unwrap_or_else(|_| { format!( "{}/.move", - std::env::var("HOME").expect("env var 'HOME' must be set") + dirs_next::home_dir() + .expect("user's home directory not found") + .to_str() + .unwrap() ) }); let rev_name = match table.remove("rev") {