Merge pull request #13 from dart-lang/use_platform_resolvedExecutable

introduce a getSdkPath() API
tree: b3f095a88bcb3abcaa3861bf02696a4bf1491163
  1. lib/
  2. test/
  3. tool/
  4. .gitignore
  5. .status
  6. .travis.yml
  7. analysis_options.yaml
  8. AUTHORS
  9. CHANGELOG.md
  10. codereview.settings
  11. CONTRIBUTING.md
  12. LICENSE
  13. pubspec.yaml
  14. README.md
README.md

cli_util

A library to help in building Dart command-line apps.

In particular, cli_util provides a simple, standardized way to get the current SDK directory. Useful, especially, when building client applications that interact with the Dart SDK (such as the analyzer).

Build Status

Usage

import 'dart:io';

import 'package:cli_util/cli_util.dart';
import 'package:path/path.dart' as path;

main(args) {
  // Get sdk dir from cli_util.
  String sdkPath = getSdkPath();
  
  // Do stuff... For example, print version string
  File versionFile = new File(path.join(sdkPath, 'version'));
  print(versionFile.readAsStringSync());
}

Features and bugs

Please file feature requests and bugs at the issue tracker.