cleanupFailedDownload static method
Cleans up failed download files for a model specification
Implementation
static Future<void> cleanupFailedDownload(ModelSpec spec) async {
debugPrint('Cleaning up failed download for model: ${spec.name}');
for (final file in spec.files) {
try {
final filePath = await getModelFilePath(file.filename);
final fileObj = File(filePath);
if (await fileObj.exists()) {
await fileObj.delete();
debugPrint('Cleaned up partial file: ${file.filename}');
}
} catch (e) {
debugPrint('Failed to cleanup file ${file.filename}: $e');
}
}
}