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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * [Link] objects are references to filesystem links. | 8 * [Link] objects are references to filesystem links. |
9 * | 9 * |
10 */ | 10 */ |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 Uri link = new Uri.file(path); | 175 Uri link = new Uri.file(path); |
176 Uri destination = new Uri.file(target); | 176 Uri destination = new Uri.file(target); |
177 String result = base.resolveUri(link).resolveUri(destination).toFilePath(); | 177 String result = base.resolveUri(link).resolveUri(destination).toFilePath(); |
178 if (result.length > 3 && result[1] == ':' && result[2] == '\\') { | 178 if (result.length > 3 && result[1] == ':' && result[2] == '\\') { |
179 return '\\??\\$result'; | 179 return '\\??\\$result'; |
180 } else { | 180 } else { |
181 throw new LinkException( | 181 throw new LinkException( |
182 'Target $result of Link.create on Windows cannot be converted' + | 182 'Target $result of Link.create on Windows cannot be converted' + |
183 ' to start with a drive letter. Unexpected error.'); | 183 ' to start with a drive letter. Unexpected error.'); |
184 } | 184 } |
185 return target; | |
186 } | 185 } |
187 | 186 |
188 void updateSync(String target) { | 187 void updateSync(String target) { |
189 // TODO(12414): Replace with atomic update, where supported by platform. | 188 // TODO(12414): Replace with atomic update, where supported by platform. |
190 // Atomically changing a link can be done by creating the new link, with | 189 // Atomically changing a link can be done by creating the new link, with |
191 // a different name, and using the rename() posix call to move it to | 190 // a different name, and using the rename() posix call to move it to |
192 // the old name atomically. | 191 // the old name atomically. |
193 deleteSync(); | 192 deleteSync(); |
194 createSync(target); | 193 createSync(target); |
195 } | 194 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 if (path != null) { | 318 if (path != null) { |
320 sb.write(", path = $path"); | 319 sb.write(", path = $path"); |
321 } | 320 } |
322 } | 321 } |
323 return sb.toString(); | 322 return sb.toString(); |
324 } | 323 } |
325 final String message; | 324 final String message; |
326 final String path; | 325 final String path; |
327 final OSError osError; | 326 final OSError osError; |
328 } | 327 } |
OLD | NEW |