Move String8 path functions to androidfw and aapt

Test: m checkbuild
Bug: 295394788
Change-Id: I9488bc5632cbd47c83f6b5f2df4c87eb324a1e8e
diff --git a/tools/aapt/Utils.h b/tools/aapt/Utils.h
index 8eb5941..f0d6979 100644
--- a/tools/aapt/Utils.h
+++ b/tools/aapt/Utils.h
@@ -26,3 +26,13 @@
 // If the default OS separator is backslash, this converts all
 // backslashes to slashes, in-place. Otherwise it does nothing.
 void convertToResPath(android::String8&);
+
+/**
+ * Retrieve the front (root dir) component.  Optionally also return the
+ * remaining components.
+ *
+ * "/tmp/foo/bar.c" --> "tmp" (remain = "foo/bar.c")
+ * "/tmp" --> "tmp" (remain = "")
+ * "bar.c" --> "bar.c" (remain = "")
+ */
+android::String8 walkPath(const android::String8& path, android::String8* outRemains = nullptr);