You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nenv/src/repository/node_path.rs

37 lines
646 B
Rust

use std::path::PathBuf;
#[derive(Clone, Debug)]
pub struct NodePath {
base: PathBuf,
}
impl NodePath {
pub fn new(base: PathBuf) -> Self {
Self { base }
}
#[cfg(not(windows))]
pub fn bin(&self) -> PathBuf {
self.base.join("bin")
}
#[cfg(windows)]
pub fn bin(&self) -> PathBuf {
self.base.to_owned()
}
#[cfg(not(windows))]
pub fn lib(&self) -> PathBuf {
self.base.join("lib")
}
#[cfg(windows)]
pub fn lib(&self) -> PathBuf {
self.base.to_owned()
}
pub fn node_modules(&self) -> PathBuf {
self.lib().join("node_modules")
}
}