Get the directory for an identity.
(&self, identity: &Identity)
| 872 | |
| 873 | /// Get the directory for an identity. |
| 874 | fn identity_dir(&self, identity: &Identity) -> PathBuf { |
| 875 | // Use a sanitized name + short ID for the directory name |
| 876 | let safe_name = identity |
| 877 | .name |
| 878 | .chars() |
| 879 | .map(|c| { |
| 880 | if c.is_alphanumeric() || c == '-' || c == '_' { |
| 881 | c |
| 882 | } else { |
| 883 | '-' |
| 884 | } |
| 885 | }) |
| 886 | .collect::<String>(); |
| 887 | |
| 888 | self.root |
| 889 | .join(format!("{}-{}", safe_name, identity.id.short())) |
| 890 | } |
| 891 | |
| 892 | /// Find the directory for an identity by ID. |
| 893 | fn find_identity_dir(&self, id: &IdentityId) -> Result<PathBuf, IdentityError> { |