sourceParentPath property

String? sourceParentPath

The source parent path of this configuration.

Implementation

String? get sourceParentPath {
  var source = _source;
  if (source == null || source.isEmpty) return null;

  var idx = source.lastIndexOf(RegExp(r'[/\\]'));
  if (idx >= 0) {
    var parent = source.substring(0, idx);

    if (parent.startsWith(RegExp(r'^file:/'))) {
      var uri = Uri.tryParse(parent);
      if (uri != null) {
        parent = uri.toFilePath();
      }
    }

    return parent;
  }

  return null;
}