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

Unified Diff: pkg/dev_compiler/lib/src/compiler/compiler.dart

Issue 2483753004: fix #27771, create directory if needed (Closed)
Patch Set: Created 4 years, 1 month 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
Index: pkg/dev_compiler/lib/src/compiler/compiler.dart
diff --git a/pkg/dev_compiler/lib/src/compiler/compiler.dart b/pkg/dev_compiler/lib/src/compiler/compiler.dart
index d2eeca4ff59d8be38389afdbfec183b572974d17..92cfc59e170b217cbc3e0c6035045a6de6ee83cd 100644
--- a/pkg/dev_compiler/lib/src/compiler/compiler.dart
+++ b/pkg/dev_compiler/lib/src/compiler/compiler.dart
@@ -502,13 +502,19 @@ class JSModuleFile {
c += '\n//# sourceURL=${name.replaceAll("/", ".")}.js\n';
c = 'eval(${JSON.encode(c)});\n';
}
- new File(jsPath).writeAsStringSync(c);
+
+ var file = new File(jsPath);
+ if (!file.parent.existsSync()) file.parent.createSync(recursive: true);
+ file.writeAsStringSync(c);
+
// TODO(jacobr): it is a bit strange we are writing the source map to a file
// even when options.inlineSourceMap is true. To be consistent perhaps we
// should also write a copy of the source file without a sourcemap even when
// inlineSourceMap is true.
if (code.sourceMap != null) {
- new File(mapPath).writeAsStringSync(JSON.encode(code.sourceMap));
+ file = new File(mapPath);
+ if (!file.parent.existsSync()) file.parent.createSync(recursive: true);
+ file.writeAsStringSync(JSON.encode(code.sourceMap));
}
}
}

Powered by Google App Engine
This is Rietveld 408576698