getIdeLockfilesPaths method
Gets the potential IDE lockfiles directories path based on platform.
Implementation
Future<List<String>> getIdeLockfilesPaths() async {
final paths = <String>['${_getNeomageConfigHomeDir()}/ide'];
if (Platform.isLinux) {
// Check for WSL
final wslDistro = Platform.environment['WSL_DISTRO_NAME'];
if (wslDistro != null) {
// Try to find Windows user profiles
try {
final usersDir = Directory('/mnt/c/Users');
if (await usersDir.exists()) {
await for (final user in usersDir.list()) {
if (user is! Directory) continue;
final name = user.path.split('/').last;
if ([
'Public',
'Default',
'Default User',
'All Users',
].contains(name)) {
continue;
}
paths.add('${user.path}/.neomage/ide');
}
}
} catch (_) {
// Expected on non-WSL or when C: isn't mounted
}
}
}
return paths;
}