| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 | 7 |
| 8 main() { | 8 main() { |
| 9 if (Platform.operatingSystem != 'windows') return; | 9 if (Platform.operatingSystem != 'windows') return; |
| 10 var tempDir = new Directory('').createTempSync(); | 10 var tempDir = new Directory('').createTempSync(); |
| 11 var funkyDir = new Directory("${tempDir.path}/å"); | 11 var funkyDir = new Directory("${tempDir.path}/å"); |
| 12 funkyDir.createSync(); | 12 funkyDir.createSync(); |
| 13 var funkyFile = new File('${funkyDir.path}/funky.bat'); | 13 var funkyFile = new File('${funkyDir.path}/funky.bat'); |
| 14 funkyFile.writeAsStringSync(""" | 14 funkyFile.writeAsStringSync(""" |
| 15 @echo off | 15 @echo off |
| 16 set SCRIPTDIR=%~dp0 | 16 set SCRIPTDIR=%~dp0 |
| 17 %1 %2 | 17 %1 %2 |
| 18 """); | 18 """); |
| 19 var options = new Options(); | 19 var dart = Platform.executable; |
| 20 var dart = options.executable; | 20 var scriptDir = new Path(Platform.script).directoryPath; |
| 21 var scriptDir = new Path(options.script).directoryPath; | |
| 22 var script = scriptDir.append('windows_environment_script.dart'); | 21 var script = scriptDir.append('windows_environment_script.dart'); |
| 23 Process.run('cmd', | 22 Process.run('cmd', |
| 24 ['/c', funkyFile.path, dart, script.toNativePath()]).then((p) { | 23 ['/c', funkyFile.path, dart, script.toNativePath()]).then((p) { |
| 25 if (0 != p.exitCode) throw "Exit code not 0"; | 24 if (0 != p.exitCode) throw "Exit code not 0"; |
| 26 tempDir.deleteSync(recursive: true); | 25 tempDir.deleteSync(recursive: true); |
| 27 }); | 26 }); |
| 28 } | 27 } |
| OLD | NEW |