From 12e9e426fa6c0158d810130f12726dc6cd12e615 Mon Sep 17 00:00:00 2001 From: Alexander Aprelev Date: Wed, 3 Jan 2018 09:43:35 -0800 Subject: [PATCH] Revert "Revert "Fix filename handling for Windows. (#4482)" (#4484)" (flutter/engine#4506) * Revert "Revert "Fix filename handling for Windows. (#4482)" (#4484)" This reverts commit fc9dac8435bc01141c549436262139ad7cee8c93. Reverting now since issue with gen_snapshot(as described in https://github.com/flutter/flutter/issues/13708) was fixed. * resolve->resolveUri, drop underscores * Fix underscore --- .../flutter/frontend_server/lib/server.dart | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/engine/src/flutter/frontend_server/lib/server.dart b/engine/src/flutter/frontend_server/lib/server.dart index 6e0fa6b74e..093710347e 100644 --- a/engine/src/flutter/frontend_server/lib/server.dart +++ b/engine/src/flutter/frontend_server/lib/server.dart @@ -128,7 +128,6 @@ class _FrontendCompiler implements CompilerInterface { BinaryPrinterFactory printerFactory; IncrementalKernelGenerator _generator; - String _filename; String _kernelBinaryFilename; @override @@ -137,7 +136,7 @@ class _FrontendCompiler implements CompilerInterface { ArgResults options, { IncrementalKernelGenerator generator, }) async { - _filename = filename; + final Uri filenameUri = Uri.base.resolveUri(new Uri.file(filename)); _kernelBinaryFilename = "$filename.dill"; final String boundaryKey = new Uuid().generateV4(); _outputStream.writeln("result $boundaryKey"); @@ -157,7 +156,7 @@ class _FrontendCompiler implements CompilerInterface { _generator = generator != null ? generator : await IncrementalKernelGenerator.newInstance( - compilerOptions, Uri.base.resolve(_filename), + compilerOptions, filenameUri, useMinimalGenerator: true); final DeltaProgram deltaProgram = await _runWithPrintRedirection(() => _generator.computeDelta()); @@ -170,9 +169,8 @@ class _FrontendCompiler implements CompilerInterface { sdkRoot.resolve('platform.dill') ]; } - program = await _runWithPrintRedirection(() => compileToKernel( - Uri.base.resolve(_filename), compilerOptions, - aot: options['aot'])); + program = await _runWithPrintRedirection(() => + compileToKernel(filenameUri, compilerOptions, aot: options['aot'])); } if (program != null) { final IOSink sink = new File(_kernelBinaryFilename).openWrite(); @@ -219,12 +217,11 @@ class _FrontendCompiler implements CompilerInterface { } Uri _ensureFolderPath(String path) { - // This is a URI, not a file path, so the forward slash is correct even - // on Windows. - if (!path.endsWith('/')) { - path = '$path/'; + String uriPath = new Uri.file(path).toString(); + if (!uriPath.endsWith('/')) { + uriPath = '$uriPath/'; } - return Uri.base.resolve(path); + return Uri.base.resolve(uriPath); } /// Runs the given function [f] in a Zone that redirects all prints into