platform/angel_migration_runner/lib/src/util.dart
2019-02-14 12:15:34 -05:00

14 lines
358 B
Dart
Executable file

import 'dart:async';
import 'dart:isolate';
import 'dart:mirrors';
Future<String> absoluteSourcePath(Type type) async {
var mirror = reflectType(type);
var uri = mirror.location.sourceUri;
if (uri.scheme == 'package') {
uri = await Isolate.resolvePackageUri(uri);
}
return uri.toFilePath() + '#' + MirrorSystem.getName(mirror.simpleName);
}