isDriveRoot function

bool isDriveRoot(
  1. String path
)

Checks whether the path represents a Windows drive root.

Implementation

bool isDriveRoot(String path) {
  if (Platform.isWindows) {
    String p = path;
    if (p.startsWith(kWindowsStoragePathPrefix)) {
      p = p.substring(kWindowsStoragePathPrefix.length);
    }
    return RegExp(r'^[a-zA-Z]:[/\\]?$').hasMatch(p);
  }
  return false;
}