How to get resource filepath

Exact resource file path according to the filename and directory can be achieved by using the following function.
char* get_filepath(char *filename, char *dir)
{

	char filepath[1000] = {0,};
	char *resource_path = NULL;
	if(!strcmp(dir, "res"))
		resource_path = app_get_resource_path(); /* get the application resource directory path */
	else if(!strcmp(dir, "shared/res"))
		resource_path = app_get_shared_resource_path();/* get shared resource directory path */
	if(resource_path)
	{
		snprintf(filepath,1000,"%s%s",resource_path,filename);
		free(resource_path); /* make resource_path free */
	}

	return filepath;
}

Responses

0 Replies