cleanStagedRuntime method
Best-effort removal of the staged runtime(s) for role in the default
(%LOCALAPPDATA%\OmnyShell\bin) location; called on uninstall.
Implementation
void cleanStagedRuntime(String role) {
final local =
Platform.environment['LOCALAPPDATA'] ?? Platform.environment['APPDATA'];
if (local == null || local.isEmpty) return;
final dir = Directory('$local\\OmnyShell\\bin');
if (!dir.existsSync()) return;
final prefix = '$role-'.toLowerCase();
for (final f in dir.listSync().whereType<File>()) {
if (_basename(f.path).toLowerCase().startsWith(prefix)) {
try {
f.deleteSync();
} on Object {
// May still be locked; leave it for the next install to overwrite.
}
}
}
}