ksud: Fix module not showing when there is a module don't declare id in module.prop. fix #890

This commit is contained in:
weishu
2023-08-20 23:34:57 +08:00
parent 76bdd12f73
commit 71799c7aed

View File

@@ -662,6 +662,16 @@ fn _list_modules(path: &str) -> Vec<HashMap<String, String>> {
module_prop_map.insert(k, v); module_prop_map.insert(k, v);
}); });
if module_prop_map["id"].is_empty() {
if let Some(id) = entry.file_name().to_str() {
info!("Use dir name as module id: {}", id);
module_prop_map.insert("id".to_owned(), id.to_owned());
} else {
info!("Failed to get module id: {:?}", module_prop);
continue;
}
}
// Add enabled, update, remove flags // Add enabled, update, remove flags
let enabled = !path.join(defs::DISABLE_FILE_NAME).exists(); let enabled = !path.join(defs::DISABLE_FILE_NAME).exists();
let update = path.join(defs::UPDATE_FILE_NAME).exists(); let update = path.join(defs::UPDATE_FILE_NAME).exists();