| 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 library hosted_source; | 5 library hosted_source; |
| 6 | 6 |
| 7 import 'dart:io' as io; | 7 import 'dart:io' as io; |
| 8 import 'dart:json'; | 8 import 'dart:json'; |
| 9 import 'dart:uri'; | 9 import 'dart:uri'; |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 }).chain((_) { | 84 }).chain((_) { |
| 85 // Now that the install has succeeded, move it to the real location in | 85 // Now that the install has succeeded, move it to the real location in |
| 86 // the cache. This ensures that we don't leave half-busted ghost | 86 // the cache. This ensures that we don't leave half-busted ghost |
| 87 // directories in the user's pub cache if an install fails. | 87 // directories in the user's pub cache if an install fails. |
| 88 var rename = renameDir(tempDir, destPath); | 88 var rename = renameDir(tempDir, destPath); |
| 89 | 89 |
| 90 // TODO(rnystrom): Awful hack. On Windows, we see cases where the extract | 90 // TODO(rnystrom): Awful hack. On Windows, we see cases where the extract |
| 91 // has not finished by the time we get here, so the rename fails with a | 91 // has not finished by the time we get here, so the rename fails with a |
| 92 // "directory in use" error. So, we will just wait a couple of seconds | 92 // "directory in use" error. So, we will just wait a couple of seconds |
| 93 // before we start. | 93 // before we start. |
| 94 if (Platform.operatingSystem == "windows") { | 94 if (io.Platform.operatingSystem == "windows") { |
| 95 rename = sleep(2000).chain((_) => rename); | 95 rename = sleep(2000).chain((_) => rename); |
| 96 } | 96 } |
| 97 | 97 |
| 98 return rename; | 98 return rename; |
| 99 }).transform((_) => true); | 99 }).transform((_) => true); |
| 100 } | 100 } |
| 101 | 101 |
| 102 /** | 102 /** |
| 103 * The system cache directory for the hosted source contains subdirectories | 103 * The system cache directory for the hosted source contains subdirectories |
| 104 * for each separate repository URL that's used on the system. Each of these | 104 * for each separate repository URL that's used on the system. Each of these |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 var name = description["name"]; | 154 var name = description["name"]; |
| 155 if (name is! String) { | 155 if (name is! String) { |
| 156 throw new FormatException("The 'name' key must have a string value."); | 156 throw new FormatException("The 'name' key must have a string value."); |
| 157 } | 157 } |
| 158 | 158 |
| 159 var url = description.containsKey("url") ? description["url"] : defaultUrl; | 159 var url = description.containsKey("url") ? description["url"] : defaultUrl; |
| 160 return new Pair<String, String>(name, url); | 160 return new Pair<String, String>(name, url); |
| 161 } | 161 } |
| 162 } | 162 } |
| OLD | NEW |