pigeon: fixed windows execution by using posix path imports (#230)

This commit is contained in:
gaaclarke
2020-10-19 18:57:39 -07:00
committed by GitHub
parent c4e9a08401
commit 4e89dd0b12
4 changed files with 12 additions and 3 deletions

View File

@ -1,3 +1,8 @@
## 0.1.13
* Fixed execution on Windows with certain setups where Dart didn't allow
backslashes in `import` statements.
## 0.1.12
* Fixed assert failure with creating a PlatformException as a result of an

View File

@ -18,7 +18,11 @@ Future<void> main(List<String> args) async {
final String rawInputPath = opts.input;
final String absInputPath = File(rawInputPath).absolute.path;
final String relInputPath = path.relative(absInputPath, from: tempDir.path);
importLine = 'import \'$relInputPath\';\n';
final List<String> relInputComponents = path.split(relInputPath);
final path.Context context = path.Context(style: path.Style.posix);
final String posixRelInputPath = context.joinAll(relInputComponents);
importLine = 'import \'$posixRelInputPath\';\n';
}
final String code = """$importLine
import 'dart:io';

View File

@ -8,7 +8,7 @@ import 'dart:mirrors';
import 'ast.dart';
/// The current version of pigeon.
const String pigeonVersion = '0.1.12';
const String pigeonVersion = '0.1.13';
/// Read all the content from [stdin] to a String.
String readStdin() {

View File

@ -1,5 +1,5 @@
name: pigeon
version: 0.1.12
version: 0.1.13
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: