pub fn abs_path( relative: &str ) -> Result< PathBuf, Error >
{
	let entry = env::current_dir()?.as_path().join( relative );

	if entry.exists()

		{ return Ok( entry.canonicalize()? ) }


	let exe    = env::current_exe()?;
	let parent = exe.parent().ok_or( std::io::Error::new( std::io::ErrorKind::NotFound, "Program executable has no parent directory" ) )?;

   // Canonicalize will throw an error if the file doesn't exist
   //
   Ok( parent.join( relative ).canonicalize()? )
}
// Takes a relative path and returns an absolute one, searching in the cwd, then relative to the executable file.
//
Takes a relative path and returns an absolute one, searching in the cwd, then relative to the executable file.
Takes a relative path and returns an absolute one searching in the cwd then relative to the executable file .
pub fn abs_path( relative: &str ) -> Result< PathBuf, Error >
{
	let entry = env::current_dir()?.as_path().join( relative );
	if entry.exists()
		{ return Ok( entry.canonicalize()? ) }
	let exe    = env::current_exe()?;
	let parent = exe.parent().ok_or( std::io::Error::new( std::io::ErrorKind::NotFound, "Program executable has no parent directory" ) )?;
   // Canonicalize will throw an error if the file doesn't exist
   //
   Ok( parent.join( relative ).canonicalize()? )
}
pub fn abs_path ( relative : & str ) -> Result < PathBuf , Error > { let entry = env :: current_dir ( ) ? . as_path ( ) . join ( relative ) ; if entry . exists ( ) { return Ok ( entry . canonicalize ( ) ? ) } let exe = env :: current_exe ( ) ? ; let parent = exe . parent ( ) . ok_or ( std :: io :: Error :: new ( std :: io :: ErrorKind :: NotFound , " " ) ) ? ; // Canonicalize will throw an error if the file doesn't exist // Ok ( parent . join ( relative ) . canonicalize ( ) ? ) }
Takes a relative path and returns an absolute one, searching in the cwd, then relative to the executable file.
Takes a relative path and returns an absolute one searching in the cwd then relative to the executable file .
relative
&str
relative
&str