navigator_invoke_local_path_to_uri()

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

Synopsis:

#include <bps/navigator_invoke.h>
 
BPS_API char* navigator_invoke_local_path_to_uri(const char *path)

Since:

BlackBerry 10.0.0

Arguments:

path

The absolute file path. It needs to start with "/".

Library:

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

Description:

The navigator_invoke_local_path_to_uri() function should be called by the application to ensure that a file path is converted to a percent-encoded file URI for use with invocation functions.

This function expects path to start with "/".

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

For example:
   char *file_uri =
                navigator_invoke_local_path_to_uri("/path/to/some file.txt");

   // file_uri is "file:///path/to/some%20file.txt"

   bps_free(file_uri);

Returns:

A percent-encoded file URI that corresponds to path upon success; NULL with errno set upon failure.