feat: install si command from settings
This commit is contained in:
@@ -73,6 +73,22 @@ pub fn documents_dir() -> PathBuf {
|
||||
dirs::document_dir().unwrap_or_else(|| dirs::home_dir().unwrap_or_default())
|
||||
}
|
||||
|
||||
/// The binary named `name` built next to the running executable, when it is there.
|
||||
pub fn sibling_binary(name: &str) -> Option<PathBuf> {
|
||||
let name = if std::env::consts::EXE_EXTENSION.is_empty() {
|
||||
name.to_owned()
|
||||
} else {
|
||||
format!("{name}.{}", std::env::consts::EXE_EXTENSION)
|
||||
};
|
||||
let binary = std::env::current_exe().ok()?.with_file_name(name);
|
||||
binary.is_file().then_some(binary)
|
||||
}
|
||||
|
||||
/// Returns the user's binary folder, `~/.local/bin`, which most shells put on the PATH.
|
||||
pub fn user_bin_dir() -> PathBuf {
|
||||
home_dir().join(".local").join("bin")
|
||||
}
|
||||
|
||||
fn config_dir() -> &'static Path {
|
||||
CONFIG_DIR.as_path()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user