Get the directory for an identity.
(&self, identity: &Identity)
| 721 | |
| 722 | /// Get the directory for an identity. |
| 723 | fn identity_dir(&self, identity: &Identity) -> PathBuf { |
| 724 | // Use a sanitized name + short ID for the directory name |
| 725 | let safe_name = identity |
| 726 | .name |
| 727 | .chars() |
| 728 | .map(|c| { |
| 729 | if c.is_alphanumeric() || c == '-' || c == '_' { |
| 730 | c |
| 731 | } else { |
| 732 | '-' |
| 733 | } |
| 734 | }) |
| 735 | .collect::<String>(); |
| 736 | |
| 737 | self.root |
| 738 | .join(format!("{}-{}", safe_name, identity.id.short())) |
| 739 | } |
| 740 | |
| 741 | /// Find the directory for an identity by ID. |
| 742 | fn find_identity_dir(&self, id: &IdentityId) -> Result<PathBuf, IdentityError> { |