mirror of https://github.com/Trivernis/nenv
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.
31 lines
606 B
Rust
31 lines
606 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(target_os = "windows"))]
|
|
pub fn bin(&self) -> PathBuf {
|
|
self.base.join("bin").canonicalize().unwrap()
|
|
}
|
|
|
|
pub fn lib(&self) -> PathBuf {
|
|
self.base.join("lib").canonicalize().unwrap()
|
|
}
|
|
|
|
pub fn node_modules(&self) -> PathBuf {
|
|
self.lib().join("node_modules")
|
|
}
|
|
|
|
#[cfg(target_os = "windows")]
|
|
pub fn bin(&self) -> PathBuf {
|
|
self.base.to_owned()
|
|
}
|
|
}
|