msysPath function

String? msysPath(
  1. String path
)

Windows path path (C:\proj, C:/proj) in the form Git Bash and other MSYS tools use (/c/proj), or null when it is not a drive path.

Implementation

String? msysPath(String path) {
  final m = RegExp(r'^([A-Za-z]):([\\/].*)?$').firstMatch(path);
  if (m == null) return null;
  final rest = (m.group(2) ?? '').replaceAll(r'\', '/');
  return p.posix.normalize('/${m.group(1)!.toLowerCase()}$rest');
}