@@ -35,7 +35,7 @@ $_usage''');
35
35
return ;
36
36
}
37
37
38
- assert (p.fromUri (Platform .script).endsWith (_thisScript));
38
+ assert (p.fromUri (Platform .script).endsWith (_thisScript. toFilePath () ));
39
39
40
40
// Run `npm install` or `npm update` as needed.
41
41
final update = argResult['update' ] as bool ;
@@ -68,7 +68,7 @@ $_usage''');
68
68
}
69
69
70
70
// Determine the set of previously generated files.
71
- final domDir = Directory (p.join (_webPackagePath, 'lib/ src/ dom' ));
71
+ final domDir = Directory (p.join (_webPackagePath, 'lib' , ' src' , ' dom' ));
72
72
final existingFiles =
73
73
domDir.listSync (recursive: true ).whereType <File >().where ((file) {
74
74
if (! file.path.endsWith ('.dart' )) return false ;
@@ -86,7 +86,7 @@ $_usage''');
86
86
'node' ,
87
87
[
88
88
'main.mjs' ,
89
- '--output-directory=${p .join (_webPackagePath , 'lib/ src' )}' ,
89
+ '--output-directory=${p .join (_webPackagePath , 'lib' , ' src' )}' ,
90
90
if (generateAll) '--generate-all' ,
91
91
],
92
92
workingDirectory: _bindingsGeneratorPath,
@@ -101,9 +101,8 @@ $_usage''');
101
101
}
102
102
103
103
// Update readme.
104
- final readmeFile = File (
105
- p.normalize (Platform .script.resolve ('../README.md' ).path),
106
- );
104
+ final readmeFile =
105
+ File (p.normalize (p.fromUri (Platform .script.resolve ('../README.md' ))));
107
106
108
107
final sourceContent = readmeFile.readAsStringSync ();
109
108
@@ -148,7 +147,7 @@ Future<String> _webPackageLanguageVersion(String pkgPath) async {
148
147
return '$languageVersion .0' ;
149
148
}
150
149
151
- final _webPackagePath = Platform .script.resolve ('../../web' ).path ;
150
+ final _webPackagePath = p. fromUri ( Platform .script.resolve ('../../web' )) ;
152
151
153
152
String _packageLockVersion (String package) {
154
153
final packageLockData = jsonDecode (
@@ -161,18 +160,19 @@ String _packageLockVersion(String package) {
161
160
return webRefIdl['version' ] as String ;
162
161
}
163
162
164
- final _bindingsGeneratorPath = Platform .script.resolve ('../lib/src' ).path ;
163
+ final _bindingsGeneratorPath = p. fromUri ( Platform .script.resolve ('../lib/src' )) ;
165
164
166
165
const _webRefCss = '@webref/css' ;
167
166
const _webRefElements = '@webref/elements' ;
168
167
const _webRefIdl = '@webref/idl' ;
169
168
170
- const _thisScript = 'bin/update_bindings.dart' ;
169
+ final _thisScript = Uri .parse ('bin/update_bindings.dart' );
170
+ final _scriptPOSIXPath = _thisScript.toFilePath (windows: false );
171
171
172
- const _startComment =
173
- '<!-- START updated by $_thisScript . Do not modify by hand -->' ;
174
- const _endComment =
175
- '<!-- END updated by $_thisScript . Do not modify by hand -->' ;
172
+ final _startComment =
173
+ '<!-- START updated by $_scriptPOSIXPath . Do not modify by hand -->' ;
174
+ final _endComment =
175
+ '<!-- END updated by $_scriptPOSIXPath . Do not modify by hand -->' ;
176
176
177
177
Future <void > _runProc (
178
178
String executable,
@@ -184,6 +184,7 @@ Future<void> _runProc(
184
184
executable,
185
185
arguments,
186
186
mode: ProcessStartMode .inheritStdio,
187
+ runInShell: Platform .isWindows,
187
188
workingDirectory: workingDirectory,
188
189
);
189
190
final procExit = await proc.exitCode;
@@ -197,7 +198,7 @@ Future<void> _runProc(
197
198
Future <void > _generateJsTypeSupertypes () async {
198
199
// Use a file that uses `dart:js_interop` for analysis.
199
200
final contextCollection = AnalysisContextCollection (
200
- includedPaths: [p.join (_webPackagePath, 'lib/ src/ dom.dart' )]);
201
+ includedPaths: [p.join (_webPackagePath, 'lib' , ' src' , ' dom.dart' )]);
201
202
final dartJsInterop = (await contextCollection.contexts.single.currentSession
202
203
.getLibraryByUri ('dart:js_interop' ) as LibraryElementResult )
203
204
.element;
@@ -240,7 +241,7 @@ Future<void> _generateJsTypeSupertypes() async {
240
241
// for details. All rights reserved. Use of this source code is governed by a
241
242
// BSD-style license that can be found in the LICENSE file.
242
243
243
- // Updated by $_thisScript . Do not modify by hand.
244
+ // Updated by $_scriptPOSIXPath . Do not modify by hand.
244
245
245
246
const Map<String, String?> jsTypeSupertypes = {
246
247
${jsTypeSupertypes .entries .map ((e ) => " ${e .key }: ${e .value }," ).join ('\n ' )}
0 commit comments