Add writable /self alias alongside /public and /data
ci / check (push) Successful in 15s

This commit is contained in:
Sausage Agent
2026-10-22 13:35:13 +00:00
parent f932ab9719
commit 34e2f35272
4 changed files with 17 additions and 7 deletions
+7 -2
View File
@@ -1,6 +1,7 @@
//! On-disk layout of a Sausage world. The folder is the source of truth:
//! `sausage run` boots every actor that it finds in `actor/`, and then
//! watches the folder (`watch.rs`).
//! watches the folder (`watch.rs`). `/self` aliases the running actor's folder;
//! `/public` and `/data` remain aliases for its `public/` and `data/`.
//!
//! ```text
//! <world>/ mounted at /, readable and writable by every actor
@@ -194,7 +195,8 @@ impl World {
/// Map a path in an actor's namespace to a host path.
///
/// - Absolute paths are relative to the world root.
/// - `/public/...` and `/data/...` alias `sender`'s folders.
/// - `/self/...` aliases `sender`'s folder; `/public/...` and `/data/...`
/// alias its corresponding children.
/// - Native senders (the console) can also give absolute host paths.
pub fn resolve(&self, sender: &str, path: &str) -> Result<PathBuf> {
let under = |base: PathBuf, rest: &str| -> Result<PathBuf> {
@@ -214,6 +216,9 @@ impl World {
if let Some(rest) = prefixed("/actor") {
return under(self.actors_root(), rest);
}
if let Some(rest) = prefixed("/self") {
return under(self.actor_dir(sender), rest);
}
if let Some(rest) = prefixed("/public") {
return under(self.public_dir(sender), rest);
}