[−][src]Struct reef::Paths
Functionality to help determine system paths
Implementations
impl Paths
[src]
pub fn home() -> PathBuf
[src]
Get the user home PathBuf
Example
use reef::Paths; let home = Paths::home(); assert!(home.exists());
pub fn env(env_name: &str) -> Option<PathBuf>
[src]
Get a path from an environment variable
pub fn which(name: &str) -> Option<PathBuf>
[src]
uses the PATH environment variable to search for a filename matching the specified name. if a matching filename is not found, it will check for the existence of name.exe and name.bat
Example
use reef::Paths; let git_path = Paths::which("git").unwrap(); assert!(git_path.exists());
pub fn shebang(path: &Path) -> Result<String>
[src]
extracts the text following the shebang #!
Example
given a file with the contents:
#!C:/Ruby26-x64/bin/ruby.exe
the shebang method will return C:/Ruby26-x64/bin/ruby.exe
use reef::Paths; use std::env; let path = std::env::temp_dir().join("test.rb"); std::fs::write(&path,b"#!C:/Ruby26-x64/bin/ruby.exe")?; let target = Paths::shebang(&path).unwrap(); assert_eq!("C:/Ruby26-x64/bin/ruby.exe",target);
pub fn application_path<P: AsRef<Path>>(
qualifier: &str,
organization: &str,
application: &str,
rel_path: P
) -> PathBuf
[src]
qualifier: &str,
organization: &str,
application: &str,
rel_path: P
) -> PathBuf
get an application specific path
Auto Trait Implementations
impl RefUnwindSafe for Paths
impl Send for Paths
impl Sync for Paths
impl Unpin for Paths
impl UnwindSafe for Paths
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,