From 4e110631098969b2ff0c478cdfe05f107485cad3 Mon Sep 17 00:00:00 2001 From: creativecreatorormaybenot Date: Tue, 6 Oct 2020 16:29:07 +0000 Subject: [PATCH] [pigeon] Fix on Windows (#216) --- packages/pigeon/CHANGELOG.md | 4 ++++ packages/pigeon/bin/pigeon.dart | 15 ++++++++++++--- packages/pigeon/lib/generator_tools.dart | 2 +- packages/pigeon/pubspec.yaml | 4 ++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/packages/pigeon/CHANGELOG.md b/packages/pigeon/CHANGELOG.md index 3763675dc3..33d5d16a54 100644 --- a/packages/pigeon/CHANGELOG.md +++ b/packages/pigeon/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.1.10 + +* Fixed bug that prevented running `pigeon` on Windows (introduced in `0.1.8`). + ## 0.1.9 * Fixed bug where executing pigeon without arguments would crash (introduced in 0.1.8). diff --git a/packages/pigeon/bin/pigeon.dart b/packages/pigeon/bin/pigeon.dart index 4415956176..6f4a31376c 100644 --- a/packages/pigeon/bin/pigeon.dart +++ b/packages/pigeon/bin/pigeon.dart @@ -5,6 +5,7 @@ import 'dart:async'; import 'dart:io'; import 'dart:isolate'; + import 'package:path/path.dart' as path; import 'package:pigeon/pigeon_lib.dart'; @@ -28,10 +29,18 @@ void main(List args, SendPort sendPort) async { sendPort.send(await Pigeon.run(args)); } """; - final String tempFilename = path.join(tempDir.path, '_pigeon_temp_.dart'); - await File(tempFilename).writeAsString(code); + + final File tempFile = File(path.join(tempDir.path, '_pigeon_temp_.dart')); + await tempFile.writeAsString(code); final ReceivePort receivePort = ReceivePort(); - Isolate.spawnUri(Uri.parse(tempFilename), args, receivePort.sendPort); + Isolate.spawnUri( + // Using Uri.file instead of Uri.parse in order to parse backslashes as + // path segment separator with Windows semantics. + Uri.file(tempFile.path), + args, + receivePort.sendPort, + ); + final Completer completer = Completer(); receivePort.listen((dynamic message) { try { diff --git a/packages/pigeon/lib/generator_tools.dart b/packages/pigeon/lib/generator_tools.dart index 05a9c6795b..65374447b3 100644 --- a/packages/pigeon/lib/generator_tools.dart +++ b/packages/pigeon/lib/generator_tools.dart @@ -8,7 +8,7 @@ import 'dart:mirrors'; import 'ast.dart'; /// The current version of pigeon. -const String pigeonVersion = '0.1.9'; +const String pigeonVersion = '0.1.10'; /// Read all the content from [stdin] to a String. String readStdin() { diff --git a/packages/pigeon/pubspec.yaml b/packages/pigeon/pubspec.yaml index c9324df0e4..909093fa2c 100644 --- a/packages/pigeon/pubspec.yaml +++ b/packages/pigeon/pubspec.yaml @@ -1,5 +1,5 @@ name: pigeon -version: 0.1.9 +version: 0.1.10 description: Code generator tool to make communication between Flutter and the host platform type-safe and easier. homepage: https://github.com/flutter/packages/tree/master/packages/pigeon dependencies: @@ -8,4 +8,4 @@ dependencies: dev_dependencies: test: ^1.11.1 environment: - sdk: '>=2.2.0 <3.0.0' \ No newline at end of file + sdk: '>=2.2.0 <3.0.0'