2020-12-13 02:25:18 +00:00
|
|
|
pub async fn read_git_version () -> Option <String> {
|
|
|
|
use tokio::{
|
2020-12-13 02:05:22 +00:00
|
|
|
fs::File,
|
2020-12-13 02:25:18 +00:00
|
|
|
io::AsyncReadExt,
|
2020-12-13 02:05:22 +00:00
|
|
|
};
|
|
|
|
|
2021-03-21 03:34:47 +00:00
|
|
|
let mut buf = vec! [0_u8; 512];
|
2020-12-13 02:05:22 +00:00
|
|
|
|
2020-12-13 02:25:18 +00:00
|
|
|
let mut f = File::open ("git_version.txt").await.ok ()?;
|
|
|
|
let bytes_read = f.read (&mut buf).await.ok ()?;
|
2020-12-13 02:05:22 +00:00
|
|
|
buf.truncate (bytes_read);
|
|
|
|
|
|
|
|
Some (String::from_utf8 (buf).ok ()?)
|
|
|
|
}
|