[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

apr_dir_make_recursive only on Unix and Win32?

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2003-10-30 01:18:35 CET

APR has versions of apr_dir_make_recursive for UNIX and Win32. On OS2 it returns NOT_IMPLEMENTED, and on Netware and Beos it doesn't exist. What is the remit of APR? That is, does it aim to provide each facility uniformly on each platform regardless of how much code that requires, or does it aim to provide some facilities only on platforms where that facility is cheaply available?

I seriously don't mean this as a dig at APR. I just want to know which it is. If the former, then we should move our cross-platform code to make a directory recursively (below) into APR where it can be of benefit to others. If the latter, then the ### comment below can go away.

- Julian

Index: subversion/libsvn_subr/io.c

  SVN_ERR (svn_path_cstring_from_utf8 (&path_apr, path, pool));

#if 0
    /* ### Use this implementation if/when apr_dir_make_recursive is
       available on all platforms, not just on Unix. --xbc */
  apr_err = apr_dir_make_recursive (path_apr, APR_OS_DEFAULT, pool);
   if (apr_err)
    return svn_error_createf
      (apr_err, NULL,
         "svn_io_make_dir_recursively: error making directory '%s'", path);
  return SVN_NO_ERROR;

  /* Try to make PATH right out */
  apr_err = apr_dir_make (path_apr, APR_OS_DEFAULT, pool);

  /* It's OK if PATH exists */
  if (!apr_err || APR_STATUS_IS_EEXIST(apr_err))
    return SVN_NO_ERROR;

  if (APR_STATUS_IS_ENOENT(apr_err))
      /* Missing an intermediate dir */
      svn_error_t *svn_err;

      dir = svn_path_dirname (path, pool);
      svn_err = svn_io_make_dir_recursively (dir, pool);

      if (!svn_err)
          apr_err = apr_dir_make (path_apr, APR_OS_DEFAULT, pool);
          if (apr_err)
            svn_err = svn_error_createf
              (apr_err, NULL,
               "svn_io_make_dir_recursively: error creating directory '%s'",

      return svn_err;

  /* If we get here, there must be an apr_err. */
  return svn_error_createf
    (apr_err, NULL,
     "svn_io_make_dir_recursively: error making '%s'", path);

To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Oct 30 01:17:44 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.