getModelFilePaths method
Gets the file paths for an installed model
Implementation
@override
Future<Map<String, String>?> getModelFilePaths(ModelSpec spec) async {
await _ensureInitialized();
try {
if (!await isModelInstalled(spec)) {
return null;
}
final filePaths = <String, String>{};
final registry = ServiceRegistry.instance;
final fileSystem = registry.fileSystemService;
for (final file in spec.files) {
// Get path based on source type
final String path;
if (file.source is FileSource) {
// External file - use path from source
path = (file.source as FileSource).path;
} else if (file.source is BundledSource) {
// Bundled source - get platform-specific bundled path
final bundledSource = file.source as BundledSource;
path = await fileSystem.getBundledResourcePath(bundledSource.resourceName);
} else {
// Downloaded/Asset file - use standard app directory
path = await ModelFileSystemManager.getModelFilePath(file.filename);
}
filePaths[file.prefsKey] = path;
}
return filePaths;
} catch (e) {
debugPrint('UnifiedModelManager: Failed to get file paths for ${spec.name}: $e');
return null;
}
}