|
|
|
@ -14,13 +14,24 @@ impl Prompt {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn print(&self) -> Result<()> {
|
|
|
|
|
unsafe {
|
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
|
stdout_handle()?,
|
|
|
|
|
self.s.as_bytes(),
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
))?;
|
|
|
|
|
match std::env::current_dir() {
|
|
|
|
|
Ok(d) => unsafe {
|
|
|
|
|
let text = d.to_str().unwrap().to_owned() + " " + &self.s;
|
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
|
stdout_handle()?,
|
|
|
|
|
text.as_bytes(),
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
))?;
|
|
|
|
|
}
|
|
|
|
|
Err(_) => unsafe {
|
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
|
stdout_handle()?,
|
|
|
|
|
self.s.as_bytes(),
|
|
|
|
|
None,
|
|
|
|
|
None,
|
|
|
|
|
))?;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|