mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 18:38:33 +00:00
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
This commit is contained in:
parent
79b3bc05d6
commit
701ce9b334
7 changed files with 69 additions and 67 deletions
|
@ -101,14 +101,14 @@ fn get_installer_dir() -> Result<PathBuf, Error> {
|
|||
|
||||
pub fn install(
|
||||
flags: DenoFlags,
|
||||
installation_dir: Option<String>,
|
||||
installation_dir: Option<PathBuf>,
|
||||
exec_name: &str,
|
||||
module_url: &str,
|
||||
args: Vec<String>,
|
||||
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![],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue