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 search 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_lib_search_paths_as_string(PARROT_INTERP, enum_runtime_ft type) +{ + ASSERT_ARGS(Parrot_lib_search_paths_as_string) + STRING *prefix; + STRING *full_search_path; + PMC *paths; + INTVAL i, n; + +/* TODO: Get the real separator, not this hacked-together stuff */ +#ifdef WIN32 + STRING * const env_search_path_sep = CONST_STRING(interp, ";"); +#else + STRING * const env_search_path_sep = 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_search_path = Parrot_str_join(interp, env_search_path_sep, paths); + + return full_search_path; +} + +/* + =item C Return a malloced C-string for the runtime prefix. The calling function 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_lib_search_paths_as_string(PARROT_INTERP, + enum_runtime_ft type) + __attribute__nonnull__(1); + void parrot_init_library_paths(PARROT_INTERP) __attribute__nonnull__(1);