Index: src/library.c =================================================================== --- src/library.c (revision 38159) +++ src/library.c (working copy) @@ -768,6 +768,50 @@ /* +=item C + +Returns a STRING that contains the specified path, separated by colons (:). + +The C is one or more of the types defined in +F. + +=cut + +*/ + +PARROT_EXPORT +PARROT_WARN_UNUSED_RESULT +PARROT_CAN_RETURN_NULL +STRING* +Parrot_path_str(PARROT_INTERP, enum_runtime_ft type) +{ + ASSERT_ARGS(Parrot_path_str) + STRING *prefix; + STRING *full_path; + PMC *paths; + INTVAL i, n; + +/* TODO: Get the real separator, not this hacked-together stuff */ +#ifdef WIN32 + STRING * const envpathsep = CONST_STRING(interp, ";"); +#else + STRING * const envpathsep = CONST_STRING(interp, ":"); +#endif + + if (type & PARROT_RUNTIME_FT_DYNEXT) + paths = get_search_paths(interp, PARROT_LIB_PATH_DYNEXT); + else if (type & (PARROT_RUNTIME_FT_PBC | PARROT_RUNTIME_FT_SOURCE)) + paths = get_search_paths(interp, PARROT_LIB_PATH_LIBRARY); + else + paths = get_search_paths(interp, PARROT_LIB_PATH_INCLUDE); + + full_path = Parrot_str_join(interp, envpathsep, paths); + + return full_path; +} + +/* + =item C Return a malloced C-string for the runtime prefix. The calling function Index: src/dynext.c =================================================================== --- src/dynext.c (revision 38159) +++ src/dynext.c (working copy) @@ -620,8 +620,18 @@ /* * XXX Parrot_ex_throw_from_c_args? return PMCNULL? * PMC Undef seems convenient, because it can be queried with get_bool() + * -- + * Changed to Parrot_ex_throw_from_c_args because silently continuing and + * giving weird errors later is not a cool look - wayland/Tim Nelson */ - return pmc_new(interp, enum_class_Undef); + /* return pmc_new(interp, enum_class_Undef); */ + + path = Parrot_path_str(interp, PARROT_RUNTIME_FT_DYNEXT); + + Parrot_ex_throw_from_c_args(interp, NULL, + EXCEPTION_LIBRARY_ERROR, + "Parrot VM: Can't load library '%Ss'; searched path %Ss\n", + wo_ext, path); } return run_init_lib(interp, handle, lib_name, wo_ext); Index: include/parrot/library.h =================================================================== --- include/parrot/library.h (revision 38159) +++ include/parrot/library.h (working copy) @@ -83,6 +83,13 @@ __attribute__nonnull__(2) FUNC_MODIFIES(*file); +PARROT_EXPORT +PARROT_WARN_UNUSED_RESULT +PARROT_CAN_RETURN_NULL +STRING* Parrot_path_str(PARROT_INTERP, + enum_runtime_ft type) + __attribute__nonnull__(1); + void parrot_init_library_paths(PARROT_INTERP) __attribute__nonnull__(1);