Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1033)

Unified Diff: pkg/kernel/lib/application_root.dart

Issue 2539783002: Revert "Store library paths relative to a given application root folder." (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/lib/analyzer/loader.dart ('k') | pkg/kernel/lib/ast.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/application_root.dart
diff --git a/pkg/kernel/lib/application_root.dart b/pkg/kernel/lib/application_root.dart
deleted file mode 100644
index ea12bede79a1d0875a86b6498363c137fbec4a2c..0000000000000000000000000000000000000000
--- a/pkg/kernel/lib/application_root.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-library kernel.application_root;
-
-import 'package:path/path.dart' as pathlib;
-
-/// Resolves URIs with the `app` scheme.
-///
-/// These are used internally in kernel to represent file paths relative to
-/// some application root. This is done to avoid storing irrelevant paths, such
-/// as the path to the home directory of the user who compiled a given file.
-class ApplicationRoot {
- static const String scheme = 'app';
-
- final String path;
-
- ApplicationRoot(this.path) {
- assert(pathlib.isAbsolute(path));
- }
-
- /// Resolves a given file path or URI to a relative URI.
- Uri resolve(String pathString) {
- var uri = Uri.parse(pathString);
- if (uri.hasScheme) return relativeUri(uri);
- return new Uri(
- scheme: ApplicationRoot.scheme,
- path: pathlib.relative(uri.path, from: this.path));
- }
-
- /// Converts `app` URIs to absolute `file` URIs.
- Uri absoluteUri(Uri uri) {
- if (uri.scheme == ApplicationRoot.scheme) {
- return new Uri(scheme: 'file', path: pathlib.join(this.path, uri.path));
- } else {
- return uri;
- }
- }
-
- /// Converts `file` URIs to `app` URIs.
- Uri relativeUri(Uri uri) {
- if (uri.scheme == 'file') {
- return new Uri(
- scheme: ApplicationRoot.scheme,
- path: pathlib.relative(uri.path, from: this.path));
- } else {
- return uri;
- }
- }
-}
« no previous file with comments | « pkg/kernel/lib/analyzer/loader.dart ('k') | pkg/kernel/lib/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698