clearCwdEnvFiles function
Clear CWD-related env files.
Implementation
Future<void> clearCwdEnvFiles(String sessionId) async {
try {
final dir = await getSessionEnvDirPath(sessionId);
final files = await Directory(dir).list().toList();
await Future.wait(
files
.whereType<File>()
.where((f) {
final name = p.basename(f.path);
return (name.startsWith('filechanged-hook-') ||
name.startsWith('cwdchanged-hook-')) &&
_hookEnvRegex.hasMatch(name);
})
.map((f) => f.writeAsString('')),
);
} catch (_) {}
}