pub fn new(
    reload: bool,
    custom_root: Option<&Path>,
  ) -> std::io::Result<Self> {
    // Only setup once.
    let home_dir = dirs::home_dir().expect("Could not get home directory.");
    let default = home_dir.join(".deno");

    let root: PathBuf = match custom_root {
      None => default,
      Some(path) => path.to_path_buf(),
    };
    let gen = root.as_path().join("gen");
    let deps = root.as_path().join("deps");
    let deps_http = deps.join("http");
    let deps_https = deps.join("https");

    let deno_dir = Self {
      root,
      gen,
      deps,
      deps_http,
      deps_https,
      reload,
    };
    deno_fs::mkdir(deno_dir.gen.as_ref(), 0o755)?;
    deno_fs::mkdir(deno_dir.deps.as_ref(), 0o755)?;
    deno_fs::mkdir(deno_dir.deps_http.as_ref(), 0o755)?;
    deno_fs::mkdir(deno_dir.deps_https.as_ref(), 0o755)?;

    debug!("root {}", deno_dir.root.display());
    debug!("gen {}", deno_dir.gen.display());
    debug!("deps {}", deno_dir.deps.display());
    debug!("deps_http {}", deno_dir.deps_http.display());
    debug!("deps_https {}", deno_dir.deps_https.display());

    Ok(deno_dir)
  }
// Must be called before using any function from this module.
// https://github.com/denoland/deno/blob/golang/deno_dir.go#L99-L111
Must be called before using any function from this module.
Must be called before using any function from this module .
pub fn new(
    reload: bool,
    custom_root: Option<&Path>,
  ) -> std::io::Result<Self> {
    // Only setup once.
    let home_dir = dirs::home_dir().expect("Could not get home directory.");
    let default = home_dir.join(".deno");
    let root: PathBuf = match custom_root {
      None => default,
      Some(path) => path.to_path_buf(),
    };
    let gen = root.as_path().join("gen");
    let deps = root.as_path().join("deps");
    let deps_http = deps.join("http");
    let deps_https = deps.join("https");
    let deno_dir = Self {
      root,
      gen,
      deps,
      deps_http,
      deps_https,
      reload,
    };
    deno_fs::mkdir(deno_dir.gen.as_ref(), 0o755)?;
    deno_fs::mkdir(deno_dir.deps.as_ref(), 0o755)?;
    deno_fs::mkdir(deno_dir.deps_http.as_ref(), 0o755)?;
    deno_fs::mkdir(deno_dir.deps_https.as_ref(), 0o755)?;
    debug!("root {}", deno_dir.root.display());
    debug!("gen {}", deno_dir.gen.display());
    debug!("deps {}", deno_dir.deps.display());
    debug!("deps_http {}", deno_dir.deps_http.display());
    debug!("deps_https {}", deno_dir.deps_https.display());
    Ok(deno_dir)
  }
pub fn new ( reload : bool , custom_root : Option < & Path > , ) -> std :: io :: Result < Self > { // Only setup once. let home_dir = dirs :: home_dir ( ) . expect ( " " ) ; let default = home_dir . join ( " " ) ; let root : PathBuf = match custom_root { None => default , Some ( path ) => path . to_path_buf ( ) , } ; let gen = root . as_path ( ) . join ( " " ) ; let deps = root . as_path ( ) . join ( " " ) ; let deps_http = deps . join ( " " ) ; let deps_https = deps . join ( " " ) ; let deno_dir = Self { root , gen , deps , deps_http , deps_https , reload , } ; deno_fs :: mkdir ( deno_dir . gen . as_ref ( ) , 0o755 ) ? ; deno_fs :: mkdir ( deno_dir . deps . as_ref ( ) , 0o755 ) ? ; deno_fs :: mkdir ( deno_dir . deps_http . as_ref ( ) , 0o755 ) ? ; deno_fs :: mkdir ( deno_dir . deps_https . as_ref ( ) , 0o755 ) ? ; debug ! ( " " deno_dir root display ( ) ) ; debug ! ( " " deno_dir gen display ( ) ) ; debug ! ( " " deno_dir deps display ( ) ) ; debug ! ( " " deno_dir deps_http display ( ) ) ; debug ! ( " " deno_dir deps_https display ( ) ) ; Ok ( deno_dir ) }
Must be called before using any function from this module.
Must be called before using any function from this module .
reload
bool
custom_root
Option<&Path>
reload
bool
custom_root
Option<&Path>