forked from akanyan/STARTLINER
feat: the other profile buttons
This commit is contained in:
@ -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
|
||||
}
|
Reference in New Issue
Block a user