From 701ce9b3342647cf01cb23c4fc28bc99ce0aa8c1 Mon Sep 17 00:00:00 2001 From: Nayeem Rahman Date: Tue, 11 Feb 2020 09:29:36 +0000 Subject: refactor: Use PathBuf for paths in flag parsing and whitelists (#3955) * Use PathBuf for DenoSubcommand::Bundle's out_file * Use PathBuf for DenoSubcommand::Format's files * Use PathBuf for DenoSubcommand::Install's dir * Use PathBuf for read/write whitelists --- cli/installer.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'cli/installer.rs') diff --git a/cli/installer.rs b/cli/installer.rs index 64fe2b416..b1a795f99 100644 --- a/cli/installer.rs +++ b/cli/installer.rs @@ -101,14 +101,14 @@ fn get_installer_dir() -> Result { pub fn install( flags: DenoFlags, - installation_dir: Option, + installation_dir: Option, exec_name: &str, module_url: &str, args: Vec, force: bool, ) -> Result<(), Error> { let installation_dir = if let Some(dir) = installation_dir { - PathBuf::from(dir).canonicalize()? + dir.canonicalize()? } else { get_installer_dir()? }; @@ -245,7 +245,7 @@ mod tests { let temp_dir = TempDir::new().expect("tempdir fail"); install( DenoFlags::default(), - Some(temp_dir.path().to_string_lossy().to_string()), + Some(temp_dir.path().to_path_buf()), "echo_test", "http://localhost:4545/cli/tests/echo_server.ts", vec![], @@ -274,7 +274,7 @@ mod tests { allow_read: true, ..DenoFlags::default() }, - Some(temp_dir.path().to_string_lossy().to_string()), + Some(temp_dir.path().to_path_buf()), "echo_test", "http://localhost:4545/cli/tests/echo_server.ts", vec!["--foobar".to_string()], @@ -301,7 +301,7 @@ mod tests { install( DenoFlags::default(), - Some(temp_dir.path().to_string_lossy().to_string()), + Some(temp_dir.path().to_path_buf()), "echo_test", &local_module_str, vec![], -- cgit v1.2.3