From: <ny...@us...> - 2006-05-05 13:35:26
|
Revision: 12 Author: nyaochi Date: 2006-05-05 06:35:12 -0700 (Fri, 05 May 2006) ViewCVS: http://svn.sourceforge.net/pmplib/?rev=12&view=rev Log Message: ----------- - Retrival of JSPL include path for Win32 CUI version. - Better criterion to distinguish Array (single playlist) and Object (multiple playlists). Modified Paths: -------------- trunk/frontend/easypmp/cui/main.c trunk/frontend/easypmp/cui/option.c trunk/frontend/easypmp/win32gui/processingdlg.h trunk/lib/playlist/jspl.c Modified: trunk/frontend/easypmp/cui/main.c =================================================================== --- trunk/frontend/easypmp/cui/main.c 2006-05-05 09:01:00 UTC (rev 11) +++ trunk/frontend/easypmp/cui/main.c 2006-05-05 13:35:12 UTC (rev 12) @@ -272,6 +272,19 @@ } filepath_addslash(opt.path_to_root); + // Generate the path_to_include + if (!opt.path_to_include[0]) { +#ifdef _WIN32 + ucs2char_t ucs2cs_jspl[] = {'j','s','p','l',0}; + + GetModuleFileNameW(GetModuleHandle(NULL), opt.path_to_include, MAX_PATH); + filepath_remove_filespec(opt.path_to_include); + filepath_addslash(opt.path_to_include); + ucs2cat(opt.path_to_include, ucs2cs_jspl); + filepath_addslash(opt.path_to_include); +#endif + } + // Create a PMP instance. pmphelp_create(pmphelp, &pmp, opt.path_to_root, opt.model); if (!pmp) { Modified: trunk/frontend/easypmp/cui/option.c =================================================================== --- trunk/frontend/easypmp/cui/option.c 2006-05-05 09:01:00 UTC (rev 11) +++ trunk/frontend/easypmp/cui/option.c 2006-05-05 13:35:12 UTC (rev 12) @@ -99,19 +99,6 @@ opt->media_info_source |= GMIF_TAG; - if (!opt->path_to_include[0]) { - char pwd[MAX_PATH+1]; - ucs2char_t ucs2pwd[MAX_PATH+1]; - ucs2char_t ucs2argv0[MAX_PATH+1]; - - getcwd(pwd, MAX_PATH); - mbstoucs2(ucs2pwd, MAX_PATH, pwd, strlen(pwd)+1); - mbstoucs2(ucs2argv0, MAX_PATH, argv[0], strlen(argv[0])+1); - filepath_relative_to_absolute(opt->path_to_include, ucs2pwd, ucs2argv0); - - filepath_remove_filespec(opt->path_to_include); - } - /* Parse the command-line arguments. */ for (;;) { int this_option_optind = optind ? optind : 1; Modified: trunk/frontend/easypmp/win32gui/processingdlg.h =================================================================== --- trunk/frontend/easypmp/win32gui/processingdlg.h 2006-05-05 09:01:00 UTC (rev 11) +++ trunk/frontend/easypmp/win32gui/processingdlg.h 2006-05-05 13:35:12 UTC (rev 12) @@ -284,6 +284,9 @@ // Set path to the include folder. ::GetModuleFileNameW(_Module.GetModuleInstance(), opt.path_to_include, MAX_PATH); ::PathRemoveFileSpecW(opt.path_to_include); + ::PathAddBackslashW(opt.path_to_include); + ucs2cat(opt.path_to_include, A2W("jspl")); + ::PathAddBackslashW(opt.path_to_include); // Set model if (!m_preference.strPlayerIdentifier.IsEmpty()) { Modified: trunk/lib/playlist/jspl.c =================================================================== --- trunk/lib/playlist/jspl.c 2006-05-05 09:01:00 UTC (rev 11) +++ trunk/lib/playlist/jspl.c 2006-05-05 13:35:12 UTC (rev 12) @@ -114,8 +114,25 @@ static int object_is_array(JSContext* cx, JSObject* obj) { - jsuint length; - return JS_HasArrayLength(cx, obj, &length) ? 1 : 0; + JSClass *jsclass = NULL; + +#ifdef JS_THREADSAFE + jsclass = JS_GetClass(cx, obj); +#else + jsclass = JS_GetClass(obj); +#endif + + if (strcmp(jsclass->name, "Array") == 0) { + return 1; + } else { + jsint length = 0; + if (JS_GetArrayLength(cx, obj, &length)) { + if (length > 0) { + return 1; + } + } + } + return 0; } static JSBool This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |