feat(hololake): add domain-routed language membrane and user PNCC
This commit is contained in:
parent
cda2e32c00
commit
d563e6fd73
34 changed files with 1949 additions and 144 deletions
|
|
@ -184,6 +184,30 @@ fn code_channel_root(app: &AppHandle) -> Result<PathBuf, String> {
|
|||
Ok(root)
|
||||
}
|
||||
|
||||
pub(crate) fn register_managed_repository(
|
||||
app: &AppHandle,
|
||||
repository: &Path,
|
||||
name: String,
|
||||
) -> Result<CodeChannelEntry, String> {
|
||||
let root = code_channel_root(app)?;
|
||||
let local_path = repository.to_string_lossy().into_owned();
|
||||
let existing_channel_id = read_registry(&root)?
|
||||
.channels
|
||||
.into_iter()
|
||||
.find(|item| item.local_path == local_path)
|
||||
.map(|item| item.channel_id);
|
||||
let mut entry = entry_for_repository(repository, "GH_PNCC_NATIVE", None, Some(name))?;
|
||||
if let Some(channel_id) = existing_channel_id {
|
||||
entry.channel_id = channel_id;
|
||||
}
|
||||
upsert_entry(&root, entry)?;
|
||||
read_registry(&root)?
|
||||
.channels
|
||||
.into_iter()
|
||||
.find(|item| item.local_path == local_path)
|
||||
.ok_or_else(|| "HOLOLAKE_USER_PNCC_CHANNEL_REGISTRATION_FAILED".to_string())
|
||||
}
|
||||
|
||||
fn ensure_root(root: &Path) -> Result<(), String> {
|
||||
fs::create_dir_all(root.join("repositories"))
|
||||
.map_err(|error| format!("HOLOLAKE_CODE_CHANNEL_STORAGE_UNAVAILABLE: {error}"))?;
|
||||
|
|
|
|||
Loading…
Reference in a new issue