globbing 0.1.2 copy "globbing: ^0.1.2" to clipboard
globbing: ^0.1.2 copied to clipboard

discontinued
outdatedDart 1 only

Globbing is a library for fast directory listing based on the wildcard patterns. Uses an intelligent search operations with reduced amount of operations of disk access.

globbing #

Globbing is a library for fast directory listing based on the wildcard patterns. Uses an intelligent search operations with reduced amount of operations of disk access.

BETA VERSION

import "dart:io";
import "package:globbing/file_list.dart";

void main() {
  // Find "unittest" packages in "pub cache"
  var pubCache = getPubCachePath();
  if (pubCache != null) {
    var mask = "**/unittest*/pubspec.yaml";
    var directory = new Directory(pubCache);
    var files = new FileList(directory, mask);
    if (!files.isEmpty) {
      var list = files.toList();
      var length = list.length;
      print("Found $length version(s) of unittest");
      for (var file in files) {
        print(file);
      }
    }
  }

  // Find "CHANGELOG" in "pub cache"
  if (pubCache != null) {
    var mask = "**/CHANGELOG*";
    var directory = new Directory(pubCache);
    var files = new FileList(directory, mask, caseSensitive: false);
    if (!files.isEmpty) {
      var list = files.toList();
      var length = list.length;
      print("Found $length 'CHANGELOG' files");
      for (var file in files) {
        print(file);
      }
    }
  }

  // Find executable files in "bin" folders
  if (pubCache != null) {
    var mask = "**/bin/*.dart";
    var directory = new Directory(pubCache);
    var files = new FileList(directory, mask);
    if (!files.isEmpty) {
      var list = files.toList();
      var length = list.length;
      print("Found $length executable files in 'bin'");
      for (var file in files) {
        print(file);
      }
    }
  }
}

String getPubCachePath() {
  var result = Platform.environment["PUB_CACHE"];
  if (result != null) {
    return result;
  }

  if (Platform.isWindows) {
    var appData = Platform.environment["APPDATA"];
    if (appData != null) {
      result = "$appData/Pub/Cache";
    }
  } else {
    var home = Platform.environment["HOME"];
    result = "$home/.pub-cache";
  }

  return result;
}
2
likes
0
pub points
88%
popularity

Publisher

unverified uploader

Globbing is a library for fast directory listing based on the wildcard patterns. Uses an intelligent search operations with reduced amount of operations of disk access.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ascii, lists

More

Packages that depend on globbing