getThinkbackSkillDir function
Get the thinkback skill directory from the installed plugin's cache path.
Searches through enabled plugins to find the thinkback plugin, then resolves the skills subdirectory.
Implementation
Future<String?> getThinkbackSkillDir() async {
// In the Dart port, we look for the plugin in the standard plugin locations.
final home = Platform.environment['HOME'] ?? '';
if (home.isEmpty) return null;
// Check common plugin installation paths.
final candidatePaths = [
p.join(home, '.neomage', 'plugins', _skillName, 'skills', _skillName),
p.join(home, '.neomage', 'plugins', getPluginId(), 'skills', _skillName),
p.join(
home,
'.neomage',
'marketplace',
getMarketplaceName(),
_skillName,
'skills',
_skillName,
),
];
for (final path in candidatePaths) {
if (await Directory(path).exists()) {
return path;
}
}
return null;
}