existingRunDir function

String? existingRunDir()

~/.flutterware/run if it exists, else null — never created here.

Its absence is one of the inspector's gates: a machine that never ran flutterware has no run dir, and a server there stays inert even under dart run. Creating it (as the GUI's flutterwareRunDir() does) would defeat that.

Implementation

String? existingRunDir() {
  var home =
      Platform.environment['HOME'] ?? Platform.environment['USERPROFILE'];
  if (home == null) return null;
  var dir = p.join(home, '.flutterware', 'run');
  return Directory(dir).existsSync() ? dir : null;
}