navigator_invoke_uri_to_local_path()

Convert a percent-encoded file URI to a file path.

Synopsis:

#include <bps/navigator_invoke.h>
 
BPS_API char* navigator_invoke_uri_to_local_path(const char *uri)

Since:

BlackBerry 10.0.0

Arguments:

uri

The URI encoded file path. It needs to start with "file:///".

Library:

libbps (For the qcc command, use the -l bps option to link against this library)

Description:

The navigator_invoke_uri_to_local_path() function can be called to convert file URIs retrieved from invocation events to file paths. This function expects uri to start with "file:///", and handles percent-encoded URIs.

This function allocates memory that needs to be freed by the bps_free() function.

For example:
   char *file_path =
        navigator_invoke_uri_to_local_path("file:///path/to/some%20file.txt");

   // file_path is "/path/to/some file.txt"

   bps_free(file_path);

Returns:

The local file path upon success; NULL with errno set upon failure.