feat: add osu! version and release stream retrieval, along with skins count functionality

This commit is contained in:
2025-07-03 14:23:11 +02:00
parent a677755451
commit 2896a68757
8 changed files with 295 additions and 31 deletions

View File

@@ -52,3 +52,30 @@ pub fn get_osu_user_config<P: AsRef<Path>>(
return Some(config_map);
}
pub fn get_osu_config<P: AsRef<Path>>(
osu_folder_path: P,
) -> Option<std::collections::HashMap<String, String>> {
// Ensure the osu! folder path is valid
if !osu_folder_path.as_ref().exists() {
return None;
}
// get the osu!.cfg file from the osu! folder
let osu_config_path = osu_folder_path.as_ref().join("osu!.cfg");
if !osu_config_path.exists() {
return None;
}
// read the osu config and return it as a map, key and value are separated by ' = '
let mut config_map = std::collections::HashMap::new();
if let Ok(contents) = std::fs::read_to_string(osu_config_path) {
for line in contents.lines() {
if let Some((key, value)) = line.split_once(" = ") {
config_map.insert(key.trim().to_string(), value.trim().to_string());
}
}
}
return Some(config_map);
}