Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: pkg/front_end/lib/src/codegen/tools.dart

Issue 3002713002: Fix logic for locating dartfmt (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/codegen/tools.dart
diff --git a/pkg/front_end/lib/src/codegen/tools.dart b/pkg/front_end/lib/src/codegen/tools.dart
index fbc2d45075b079bc3b1e5d12ae87e2952db51f81..fe2fca4af5ad279bd3519ab52399bbe2e41561a9 100644
--- a/pkg/front_end/lib/src/codegen/tools.dart
+++ b/pkg/front_end/lib/src/codegen/tools.dart
@@ -238,7 +238,13 @@ class GeneratedFile extends GeneratedContent {
class DartFormat {
static String get _dartfmtPath {
String binName = Platform.isWindows ? 'dartfmt.bat' : 'dartfmt';
- return join(dirname(Platform.resolvedExecutable), binName);
+ for (var loc in [binName, join('dart-sdk', 'bin', binName)]) {
+ var candidatePath = join(dirname(Platform.resolvedExecutable), loc);
+ if (new File(candidatePath).existsSync()) {
+ return candidatePath;
+ }
+ }
+ throw new StateError('Could not find dartfmt executable');
}
static void formatFile(File file) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698