OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library utils; | 5 library utils; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:utf' as utf; | 9 import 'dart:utf' as utf; |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 return utf.encodeUtf8(string); | 68 return utf.encodeUtf8(string); |
69 } | 69 } |
70 | 70 |
71 // TODO(kustermann,ricow): As soon we have a debug log we should log | 71 // TODO(kustermann,ricow): As soon we have a debug log we should log |
72 // invalid utf8-encoded input to the log. | 72 // invalid utf8-encoded input to the log. |
73 // Currently invalid bytes will be replaced by a replacement character. | 73 // Currently invalid bytes will be replaced by a replacement character. |
74 String decodeUtf8(List<int> bytes) { | 74 String decodeUtf8(List<int> bytes) { |
75 return utf.decodeUtf8(bytes); | 75 return utf.decodeUtf8(bytes); |
76 } | 76 } |
77 | 77 |
| 78 // This function is pretty stupid and only puts quotes around an argument if |
| 79 // it the argument contains a space. |
| 80 String escapeCommandLineArgument(String argument) { |
| 81 if (argument.contains(' ')) { |
| 82 return '"$argument"'; |
| 83 } |
| 84 return argument; |
| 85 } |
| 86 |
OLD | NEW |