NAME

XtResolvePathname - search for a file using standard substitution

SYNTAX

String XtResolvePathname(Display *_d_i_s_p_l_a_y, String _t_y_p_e, String _f_i_l_e_n_a_m_e, String _s_u_f_f_i_x, String _p_a_t_h, Substitution _s_u_b_s_t_i_t_u_t_i_o_n_s, Cardinal _n_u_m___s_u_b_s_t_i_t_u_t_i_o_n_s, XtFilePredicate _p_r_e_d_i_c_a_t_e);

ARGUMENTS

_d_i_s_p_l_a_y Specifies the display to use to find the language for language substitutions.
_t_y_p_e
_f_i_l_e_n_a_m_e
_s_u_f_f_i_x Specify values to substitute into the path.
_p_a_t_h Specifies the list of file specifications, or NULL.
_s_u_b_s_t_i_t_u_t_i_o_n_s Specifies a list of additional substitutions to make into the path, or NULL.
_n_u_m___s_u_b_s_t_i_t_u_t_i_o_n_s Specifies the number of entries in _s_u_b_s_t_i_t_u_t_i_o_n_s.
_p_r_e_d_i_c_a_t_e Specifies a procedure called to judge each potential file name, or NULL.

DESCRIPTION

The substitutions specified by _X_t_R_e_s_o_l_v_e_P_a_t_h_n_a_m_e are determined from the value of the language string retrieved by _X_t_D_i_s_p_l_a_y_I_n_i_t_i_a_l_i_z_e for the specified display. To set the language for all applications specify ``*xnlLanguage: _l_a_n_g'' in the resource database. The format and content of the language string are implementation-defined. One suggested syntax is to compose the language string of three parts; a ``language part'', a ``territory part'' and a ``codeset part''. The manner in which this composition is accomplished is implementation-defined and the Intrinsics make no interpretation of the parts other than to use them in substitutions as described below.

_X_t_R_e_s_o_l_v_e_P_a_t_h_n_a_m_e calls _X_t_F_i_n_d_F_i_l_e with the following substitutions in addition to any passed by the caller and returns the value returned by _X_t_F_i_n_d_F_i_l_e:

%N The value of the _f_i_l_e_n_a_m_e parameter, or the application's
class name if _f_i_l_e_n_a_m_e is NULL.
%T The value of the _t_y_p_e parameter.
%S The value of the _s_u_f_f_i_x parameter.
%L The language string associated with the specified display.
%l The language part of the display's language string.
%t The territory part of the display's language string.
%c The codeset part of the display's language string.
%C The customization string retrieved from the resource
database associated with _d_i_s_p_l_a_y.
%D The value of the implementation-specific default path.

If a path is passed to _X_t_R_e_s_o_l_v_e_P_a_t_h_n_a_m_e, it will be passed along to _X_t_F_i_n_d_F_i_l_e. If the _p_a_t_h argument is NULL, the value of the _X_F_I_L_E_S_E_A_R_C_H_P_A_T_H environment variable will be passed to _X_t_F_i_n_d_F_i_l_e. If _X_F_I_L_E_S_E_A_R_C_H_P_A_T_H is not defined, an implementation-specific default path will be used which contains at least 6 entries. These entries must contain the following substitutions:


1. %C, %N, %S, %T, %L  or  %C, %N, %S, %T, %l, %t, %c
2. %C, %N, %S, %T, %l
3. %C, %N, %S, %T
4. %N, %S, %T, %L      or  %N, %S, %T, %l, %t, %c
5. %N, %S, %T, %l
6. %N, %S, %T

The order of these six entries within the path must be as given above. The order and use of substitutions within a given entry is implementation dependent. If the path begins with a colon, it will be preceded by %N%S. If the path includes two adjacent colons, %%NN%%SS will be inserted between them.

The _t_y_p_e parameter is intended to be a category of files, usually being translated into a directory in the pathname. Possible values might include ``app-defaults'', ``help'', and ``bitmap''.

The _s_u_f_f_i_x parameter is intended to be appended to the file name. Possible values might include ``.txt'', ``.dat'', and ``.bm''.

A suggested value for the default path on POSIX-based systems is

/usr/X11R7/lib/X11/%L/%T/%N%C%S:/usr/X11R7/lib/X11/%l/%T/%N%C%S:\

/usr/X11R7/lib/X11/%T/%N%C%S:/usr/X11R7/lib/X11/%L/%T/%N%S:\
/usr/X11R7/lib/X11/%l/%T/%N%S:/usr/X11R7/lib/X11/%T/%N%S

Using this example, if the user has specified a language, it will be used as a subdirectory of /usr/X11R7/lib/X11 that will be searched for other files. If the desired file is not found there, the lookup will be tried again using just the language part of the specification. If the file is not there, it will be looked for in /usr/X11R7/lib/X11. The _t_y_p_e parameter is used as a subdirectory of the language directory or of /usr/X11R7/lib/X11, and _s_u_f_f_i_x is appended to the file name.

The %D substitution allows the addition of path elements to the implementation-specific default path, typically to allow additional directories to be searched without preventing resources in the system directories from being found. For example, a user installing resource files under a directory called ``ourdir'' might set _X_F_I_L_E_S_E_A_R_C_H_P_A_T_H to

%D:ourdir/%T/%N%C:ourdir/%T/%N

The customization string is obtained by querying the resource database currently associated with the display (the database returned by _X_r_m_G_e_t_D_a_t_a_b_a_s_e) for the resource _a_p_p_l_i_c_a_t_i_o_n___n_a_m_e.customization, class _a_p_p_l_i_c_a_t_i_o_n___c_l_a_s_s.Customization where _a_p_p_l_i_c_a_t_i_o_n___n_a_m_e and _a_p_p_l_i_c_a_t_i_o_n___c_l_a_s_s are the values returned by _X_t_G_e_t_A_p_p_l_i_c_a_t_i_o_n_N_a_m_e_A_n_d_C_l_a_s_s. If no value is specified in the database, the empty string is used.

It is the responsibility of the caller to free the returned string using _X_t_F_r_e_e when it is no longer needed.

SEE ALSO


_X _T_o_o_l_k_i_t _I_n_t_r_i_n_s_i_c_s _- _C _L_a_n_g_u_a_g_e _I_n_t_e_r_f_a_c_e
_X_l_i_b _- _C _L_a_n_g_u_a_g_e _X _I_n_t_e_r_f_a_c_e