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 barback.asset_id; | 5 library barback.asset_id; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:pathos/path.dart' as pathos; | 10 import 'package:path/path.dart' as pathos; |
11 | 11 |
12 /// AssetIDs always use POSIX style paths regardless of the host platform. | 12 /// AssetIDs always use POSIX style paths regardless of the host platform. |
13 final _posix = new pathos.Builder(style: pathos.Style.posix); | 13 final _posix = new pathos.Builder(style: pathos.Style.posix); |
14 | 14 |
15 /// Identifies an asset within a package. | 15 /// Identifies an asset within a package. |
16 class AssetId { | 16 class AssetId { |
17 /// The name of the package containing this asset. | 17 /// The name of the package containing this asset. |
18 final String package; | 18 final String package; |
19 | 19 |
20 /// The path to the asset relative to the root directory of [package]. | 20 /// The path to the asset relative to the root directory of [package]. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 /// but with file extension [newExtension]. | 82 /// but with file extension [newExtension]. |
83 AssetId changeExtension(String newExtension) => | 83 AssetId changeExtension(String newExtension) => |
84 new AssetId(package, pathos.withoutExtension(path) + newExtension); | 84 new AssetId(package, pathos.withoutExtension(path) + newExtension); |
85 | 85 |
86 String toString() => "$package|$path"; | 86 String toString() => "$package|$path"; |
87 | 87 |
88 /// Serializes this [AssetId] to an object that can be sent across isolates | 88 /// Serializes this [AssetId] to an object that can be sent across isolates |
89 /// and passed to [deserialize]. | 89 /// and passed to [deserialize]. |
90 serialize() => [package, path]; | 90 serialize() => [package, path]; |
91 } | 91 } |
OLD | NEW |