From 35acd03c1563a092d9fc282455c1b5a04105c325 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Tue, 28 Nov 2017 13:58:51 -0800 Subject: [PATCH] Run frontend server from temp directory to force absolute URIs in Kernel file. (flutter/engine#4394) * Run frontend server from temp directory to force absolute URIs in Kernel file. * Create special directory to cwd into to avoid conflicts with app sources in temp folder * Make variable final --- engine/src/flutter/frontend_server/lib/server.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/engine/src/flutter/frontend_server/lib/server.dart b/engine/src/flutter/frontend_server/lib/server.dart index 4828200ec9..c0085153d8 100644 --- a/engine/src/flutter/frontend_server/lib/server.dart +++ b/engine/src/flutter/frontend_server/lib/server.dart @@ -258,6 +258,13 @@ Future starter(List args, { compiler ??= new _FrontendCompiler(output, printerFactory: binaryPrinterFactory); input ??= stdin; + // Has to be a directory, that won't have any of the compiled application + // sources, so that no relative paths could show up in the kernel file. + Directory.current = Directory.systemTemp; + final Directory workingDirectory = new Directory("flutter_frontend_server"); + workingDirectory.createSync(); + Directory.current = workingDirectory; + if (options.rest.isNotEmpty) { await compiler.compile(options.rest[0], options, generator: generator); return 0;