mirror of
https://github.com/NVIDIA/OpenShell.git
synced 2026-11-03 08:17:44 +08:00
feat(vm): add openshell-vm crate with libkrun microVM gateway (#611)
This commit is contained in:
@@ -29,6 +29,19 @@ pub fn openshell_config_dir() -> Result<PathBuf> {
|
||||
Ok(xdg_config_dir()?.join("openshell"))
|
||||
}
|
||||
|
||||
/// Resolve the XDG data base directory.
|
||||
///
|
||||
/// Returns `$XDG_DATA_HOME` if set, otherwise `$HOME/.local/share`.
|
||||
pub fn xdg_data_dir() -> Result<PathBuf> {
|
||||
if let Ok(path) = std::env::var("XDG_DATA_HOME") {
|
||||
return Ok(PathBuf::from(path));
|
||||
}
|
||||
let home = std::env::var("HOME")
|
||||
.into_diagnostic()
|
||||
.wrap_err("HOME is not set")?;
|
||||
Ok(PathBuf::from(home).join(".local").join("share"))
|
||||
}
|
||||
|
||||
/// Create a directory (and parents) with owner-only permissions (`0o700`) on
|
||||
/// Unix. On non-Unix platforms, falls back to default permissions.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user