Index: sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart |
diff --git a/sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart b/sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart |
index 89b1861fe2bea66c056c40ee608b9c38b5f34c4a..20e6bee19a3e5ff2a1f1ff1102ea613beef3e401 100644 |
--- a/sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart |
+++ b/sdk/lib/_internal/dartdoc/lib/src/dartdoc/utils.dart |
@@ -121,6 +121,16 @@ String fileUriToPath(Uri uri) { |
return uri.path.replaceFirst("/", "").replaceAll("/", "\\"); |
} |
+/** Converts a local path string to a `file:` [Uri]. */ |
+Uri pathToFileUri(String path) { |
+ path = pathos.absolute(path); |
+ if (Platform.operatingSystem != 'windows') { |
+ return Uri.parse('file://$path'); |
+ } else { |
+ return Uri.parse('file:///${path.replaceAll("\\", "/")}'); |
+ } |
+} |
+ |
/** |
* If [map] contains an [Export] under [key], this merges that with [export]. |
* Otherwise, it sets [key] to [export]. |