Storage_GetAbsolutePathInImagePackage Function

Header: #include <applibs/storage.h>

Gets a null-terminated string that contains the absolute path to a location within the image package of the running application, given a relative path inside the image package.

The location of the image package and the path returned by this function will not change while an application is running. However, the location may change between executions of an application.

This function allocates memory for the returned string, which should be freed by the caller using free().

This function does not check whether the path exists in the image package. The path cannot not begin with '/' or '.', and cannot not contain '..'.

char *Storage_GetAbsolutePathInImagePackage(const char *relativePath);

Parameters

  • relativePath A relative path from the root of the image package. This value must not start with the directory separator character '/'.

Errors

Returns NULL if an error is encountered and sets errno to the error value.

  • EINVAL: relativePath begins with '/' or '.', or contains '..'.

  • EFAULT: relativePath is NULL.

  • ENOMEM: Out of memory.

Any other errno may also be specified; such errors aren't deterministic and the same behavior might not be retained through system updates.

Return value

Returns the absolute path that includes the image package root, or NULL on error, in which case errno is set to the error value.

Concepts and samples