static Bool locate_js_script(char *path, const char *file_name, const char *file_ext)
{
	u32 len = (u32) strlen(path);
	u32 flen = 20 + (u32) strlen(file_name);

	char *apath = gf_malloc(sizeof(char) * (len+flen) );
	if (!apath) return GF_FALSE;
	strcpy(apath, path);

	strcat(apath, file_name);
	if (gf_file_exists(apath)) {
		gf_free(apath);
		return GF_TRUE;
	}

	if (!file_ext) {
		strcat(apath, ".js");
		if (gf_file_exists(apath)) {
			gf_free(apath);
			return GF_TRUE;
		}
	}
	apath[len] = 0;
	strcat(apath, file_name);
	strcat(apath, "/init.js");
	if (gf_file_exists(apath)) {
		gf_free(apath);
		return GF_TRUE;
	}
	gf_free(apath);
	return GF_FALSE;
}
static Bool locate_js_script(char *path, const char *file_name, const char *file_ext)
{
	u32 len = (u32) strlen(path);
	u32 flen = 20 + (u32) strlen(file_name);

	char *apath = gf_malloc(sizeof(char) * (len+flen) );
	if (!apath) return GF_FALSE;
	strcpy(apath, path);

	strcat(apath, file_name);
	if (gf_file_exists(apath)) {
		gf_free(apath);
		return GF_TRUE;
	}

	if (!file_ext) {
		strcat(apath, ".js");
		if (gf_file_exists(apath)) {
			gf_free(apath);
			return GF_TRUE;
		}
	}
	apath[len] = 0;
	strcat(apath, file_name);
	strcat(apath, "/init.js");
	if (gf_file_exists(apath)) {
		gf_free(apath);
		return GF_TRUE;
	}
	gf_free(apath);
	return GF_FALSE;
}