return currDir;
}
+int rpmMkdirs(const char *root, const char *pathstr)
+{
+ ARGV_t dirs = NULL;
+ int rc = 0;
+ argvSplit(&dirs, pathstr, ":");
+
+ for (char **d = dirs; *d; d++) {
+ char *path = rpmGetPath(root ? root : "", "/", *d, NULL);
+ if ((rc = rpmioMkpath(path, 0755, -1, -1)) != 0) {
+ const char *msg = _("failed to create directory");
+ /* try to be more informative if the failing part was a macro */
+ if (**d == '%') {
+ rpmlog(RPMLOG_ERR, "%s %s: %s: %m\n", msg, *d, path);
+ } else {
+ rpmlog(RPMLOG_ERR, "%s %s: %m\n", msg, path);
+ }
+ }
+ free(path);
+ if (rc) break;
+ }
+ argvFree(dirs);
+ return rc;
+}
int rpmioMkpath(const char * path, mode_t mode, uid_t uid, gid_t gid);
/** \ingroup rpmfileutil
+ * Create several directories (including parents if needed) in one go.
+ * Macros in pathstr will be expanded in the process.
+ * @param root leading root directory (or NULL for none)
+ * @param pathstr list of directories separated with :
+ * @return 0 if all directories were successfully created
+ * (or already existed), non-zero otherwise
+ */
+int rpmMkdirs(const char *root, const char *pathstr);
+
+/** \ingroup rpmfileutil
* Canonicalize file path.
* @param path path to canonicalize (in-place)
* @return pointer to path