deepujain commented on code in PR #8307:
URL: https://github.com/apache/hadoop/pull/8307#discussion_r2908547249
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/Path.java:
##########
@@ -361,6 +378,48 @@ public static boolean isWindowsAbsolutePath(final String
pathString,
*/
public URI toUri() { return uri; }
+ /**
+ * Return a URI for this path that is suitable for use as a directory base
+ * with {@link URI#resolve(String)}. The returned URI's path component
+ * ends with "/", so that {@code dirUri.resolve("child")} yields
+ * {@code .../dir/child} rather than replacing the last segment.
+ *
+ * @param uri a filesystem or path URI
+ * @return a URI with path ending in "/" (or "/" when path is empty)
+ */
+ public static URI ensureDirectoryUri(URI uri) {
Review Comment:
Keeping them on public Path gives callers a single, clear API for “directory
URI for this path” (e.g.
getWorkingDirectory().asDirectory().toUri().resolve("x")) instead of string
hacks. If the project prefers these as package-private or on an internal
helper, I can move them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]