-
-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
118 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::error::Result; | ||
use etcetera::BaseStrategy as _; | ||
use std::env; | ||
use std::path::PathBuf; | ||
use std::str; | ||
|
||
pub const BAT_VERSION: &str = { | ||
let mut bytes = include_str!("bat.version").as_bytes(); | ||
while let [rest @ .., b'\n' | b'\r'] = bytes { | ||
bytes = rest; | ||
} | ||
if let Ok(version) = str::from_utf8(bytes) { | ||
version | ||
} else { | ||
panic!() | ||
} | ||
}; | ||
|
||
pub fn cache_dir() -> Result<PathBuf> { | ||
if let Some(cache_dir) = env::var_os("BAT_CACHE_PATH") { | ||
return Ok(PathBuf::from(cache_dir)); | ||
} | ||
|
||
let basedirs = etcetera::choose_base_strategy()?; | ||
Ok(basedirs.cache_dir().join("bat")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0.24.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters