feat: the other profile buttons

This commit is contained in:
2025-03-14 00:23:47 +00:00
parent fd27000c05
commit 90ba27c967
11 changed files with 112 additions and 33 deletions

View File

@ -55,7 +55,7 @@ impl AnyProfile {
pub fn rename(&mut self, name: String) {
match self {
Self::OngekiProfile(p) => {
p.name = Some(name);
p.name = Some(fixed_name(&ProfileMeta { name, game: Game::Ongeki }, false));
}
}
}
@ -159,4 +159,16 @@ fn meta_from_path(path: impl AsRef<Path>) -> Option<ProfileMeta> {
}
None
}
pub fn fixed_name(meta: &ProfileMeta, prepend_new: bool) -> String {
let mut name = meta.name.trim()
.replace(" ", "-")
.replace("..", "").replace("/", "").replace("\\", "");
while prepend_new && util::profile_config_dir(&meta.game, &name).exists() {
name = format!("new-{}", name);
}
name
}