Function rcutils_expand_user

Function Documentation

char *rcutils_expand_user(const char *path, rcutils_allocator_t allocator)

Expand user directory in path.

This function expands an initial ‘~’ to the current user’s home directory. The home directory is fetched using rcutils_get_home_dir(). This function returns a newly allocated string on success. It is up to the caller to release the memory once it is done with it by calling deallocate on the same allocator passed here.

Parameters:
  • path[in] A null-terminated C string representing a path.

  • allocator[in]

Returns:

path with expanded home directory on success, or

Returns:

NULL on invalid arguments, or

Returns:

NULL on failure.