mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 18:31:52 +00:00
39 lines
1.0 KiB
Rust
39 lines
1.0 KiB
Rust
use std::path::{Path, PathBuf};
|
|
|
|
pub use helpers::script_dir;
|
|
pub use models::VolumeId;
|
|
use models::{HostId, PackageId};
|
|
|
|
use crate::net::PACKAGE_CERT_PATH;
|
|
use crate::prelude::*;
|
|
use crate::util::Version;
|
|
|
|
pub const PKG_VOLUME_DIR: &str = "package-data/volumes";
|
|
pub const BACKUP_DIR: &str = "/media/embassy/backups";
|
|
|
|
pub fn data_dir<P: AsRef<Path>>(datadir: P, pkg_id: &PackageId, volume_id: &VolumeId) -> PathBuf {
|
|
datadir
|
|
.as_ref()
|
|
.join(PKG_VOLUME_DIR)
|
|
.join(pkg_id)
|
|
.join("data")
|
|
.join(volume_id)
|
|
}
|
|
|
|
pub fn asset_dir<P: AsRef<Path>>(datadir: P, pkg_id: &PackageId, version: &Version) -> PathBuf {
|
|
datadir
|
|
.as_ref()
|
|
.join(PKG_VOLUME_DIR)
|
|
.join(pkg_id)
|
|
.join("assets")
|
|
.join(version.as_str())
|
|
}
|
|
|
|
pub fn backup_dir(pkg_id: &PackageId) -> PathBuf {
|
|
Path::new(BACKUP_DIR).join(pkg_id).join("data")
|
|
}
|
|
|
|
pub fn cert_dir(pkg_id: &PackageId, host_id: &HostId) -> PathBuf {
|
|
Path::new(PACKAGE_CERT_PATH).join(pkg_id).join(host_id)
|
|
}
|