Skip to main content

apr_filepath_root

Function apr_filepath_root 

Source
pub unsafe extern "C" fn apr_filepath_root(
    rootpath: *mut *const c_char,
    filepath: *mut *const c_char,
    flags: apr_int32_t,
    p: *mut apr_pool_t,
) -> apr_status_t
Expand description

Extract the rootpath from the given filepath @param rootpath the root file path returned with APR_SUCCESS or APR_EINCOMPLETE @param filepath the pathname to parse for its root component @param flags the desired rules to apply, from

     APR_FILEPATH_NATIVE    Use native path separators (e.g. '\' on Win32)
     APR_FILEPATH_TRUENAME  Tests that the root exists, and makes it proper
@param p the pool to allocate the new path string from @remark on return, filepath points to the first non-root character in the given filepath. In the simplest example, given a filepath of "/foo", returns the rootpath of "/" and filepath points at "foo". This is far more complex on other platforms, which will canonicalize the root form to a consistant format, given the APR_FILEPATH_TRUENAME flag, and also test for the validity of that root (e.g., that a drive d:/ or network share //machine/foovol/). The function returns APR_ERELATIVE if filepath isn't rooted (an error), APR_EINCOMPLETE if the root path is ambiguous (but potentially legitimate, e.g. "/" on Windows is incomplete because it doesn't specify the drive letter), or APR_EBADPATH if the root is simply invalid. APR_SUCCESS is returned if filepath is an absolute path.