User Tools

A PCRE internal error occured. This might be caused by a faulty plugin

====== Function MERGE-PATHNAMES ====== ====Syntax==== * **merge-pathnames** //pathname// ''&optional'' //default-pathname// //default-version// → //merged-pathname// ====Arguments and Values==== * //pathname// - a //[[CL:Glossary:pathname designator]]//. * //default-pathname// - a //[[CL:Glossary:pathname designator]]//. The default is the //[[CL:Glossary:value]]// of **[[CL:Variables:star-default-pathname-defaults-star|*default-pathname-defaults*]]**. * //default-version// - a //[[CL:Glossary:valid pathname version]]//. The default is **'':newest''**. * //merged-pathname// - a //[[CL:Glossary:pathname]]//. ====Description==== Constructs a //[[CL:Glossary:pathname]]// from //pathname// by filling in any unsupplied components with the corresponding values from //default-pathname// and //default-version//. Defaulting of pathname components is done by filling in components taken from another //[[CL:Glossary:pathname]]//. This is especially useful for cases such as a program that has an input file and an output file. Unspecified components of the output pathname will come from the input pathname, except that the type should not default to the type of the input pathname but rather to the appropriate default type for output from the program; for example, see the //[[CL:Glossary:function]]// **[[CL:Functions:compile-file-pathname]]**. If no version is supplied, //default-version// is used. If //default-version// is **[[CL:Constant Variables:nil]]**, the version component will remain unchanged. If //pathname// explicitly specifies a host and not a device, and if the host component of //default-pathname// matches the host component of //pathname//, then the device is taken from the //default-pathname//; otherwise the device will be the default file device for that host. If //pathname// does not specify a host, device, directory, name, or type, each such component is copied from //default-pathname//. If //pathname// does not specify a name, then the version, if not provided, will come from //default-pathname//, just like the other components. If //pathname// does specify a name, then the version is not affected by //default-pathname//. If this process leaves the version missing, the //default-version// is used. If the host's file name syntax provides a way to input a version without a name or type, the user can let the name and type default but supply a version different from the one in //default-pathname//. If //pathname// is a //[[CL:Glossary:stream]]//, //pathname// effectively becomes ''(pathname //pathname//)''. **merge-pathnames** can be used on either an open or a closed //[[CL:Glossary:stream]]//. If //pathname// is a //[[CL:Glossary:pathname]]//, it represents the name used to open the file. This may be, but is not required to be, the actual name of the file. **merge-pathnames** recognizes a //[[CL:Glossary:logical pathname]]// //[[CL:Glossary:namestring]]// when //default-pathname// is a //[[CL:Glossary:logical pathname]]//, or when the //[[CL:Glossary:namestring]]// begins with the name of a defined //[[CL:Glossary:logical host]]// followed by a //[[CL:Glossary:colon]]//. In the first of these two cases, the host portion of the //[[CL:Glossary:logical pathname]]// //[[CL:Glossary:namestring]]// and its following //[[CL:Glossary:colon]]// are optional. **merge-pathnames** returns a //[[CL:Glossary:logical pathname]]// if and only if its first argument is a //[[CL:Glossary:logical pathname]]//, or its first argument is a //[[CL:Glossary:logical pathname]]// //[[CL:Glossary:namestring]]// with an explicit host, or its first argument does not specify a host and the //default-pathname// is a //[[CL:Glossary:logical pathname]]//. //[[CL:Glossary:Pathname]]// merging treats a relative directory specially. If ''(pathname-directory //pathname//)'' is a //[[CL:Glossary:list]]// whose //[[CL:Glossary:car]]// is **'':relative''**, and ''(pathname-directory //default-pathname//)'' is a //[[CL:Glossary:list]]//, then the merged directory is the value of: <blockquote> ([[CL:Functions:append]] ([[CL:Functions:pathname-directory]] //default-pathname//) ([[CL:Functions:cdr]] ;remove :RELATIVE from the front ([[CL:Functions:pathname-directory]] //pathname//))) </blockquote> except that if the resulting //[[CL:Glossary:list]]// contains a //[[CL:Glossary:string]]// or **'':wild''** immediately followed by **'':back''**, both of them are removed. This removal of redundant **'':back''** //[[CL:Glossary:keywords]]// is repeated as many times as possible. If ''([[CL:Functions:pathname-directory]] //default-pathname//)'' is not a //[[CL:Glossary:list]]// or ''([[CL:Functions:pathname-directory]] //pathname//)'' is not a //[[CL:Glossary:list]]// whose //[[CL:Glossary:car]]// is **'':relative''**, the merged directory is ''([[CL:Macros:or]] ([[CL:Functions:pathname-directory]] //pathname//) ([[CL:Functions:pathname-directory]] //default-pathname//))'' **merge-pathnames** maps customary case in //pathname// into customary case in the output //[[CL:Glossary:pathname]]//. ====Examples==== <blockquote> (merge-pathnames "CMUC::FORMAT" "CMUC::PS:<LISPIO>.FASL") <r>#P"CMUC::PS:<LISPIO>FORMAT.FASL.0"</r> </blockquote> ====Affected By==== None. ====Exceptional Situations==== None. ====See Also==== * **[[CL:Variables:star-default-pathname-defaults-star|Variable *DEFAULT-PATHNAME-DEFAULTS*]]** * **[[CL:Types:pathname|System Class PATHNAME]]** * **[[CL:Types:logical-pathname|System Class LOGICAL-PATHNAME]]** * {\secref\FileSystemConcepts} * {\secref\PathnamesAsFilenames} ====Notes==== The net effect is that if just a name is supplied, the host, device, directory, and type will come from //default-pathname//, but the version will come from //default-version//. If nothing or just a directory is supplied, the name, type, and version will come from //default-pathname// together. \issue{PATHNAME-LOGICAL:ADD} \issue{FILE-OPEN-ERROR:SIGNAL-FILE-ERROR} \issue{PATHNAME-STREAM} \issue{PATHNAME-STREAM} \issue{PATHNAME-UNSPECIFIC-COMPONENT:NEW-TOKEN} \issue{COMPILE-FILE-OUTPUT-FILE-DEFAULTS:INPUT-FILE} \issue{CLOSED-STREAM-FUNCTIONS:ALLOW-INQUIRY} \issue{PATHNAME-LOGICAL:ADD} \issue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES} \issue{PATHNAME-LOGICAL:ADD} \issue{PATHNAME-HOST-PARSING:RECOGNIZE-LOGICAL-HOST-NAMES} \issue{PATHNAME-SUBDIRECTORY-LIST:NEW-REPRESENTATION} \issue{PATHNAME-COMPONENT-CASE:KEYWORD-ARGUMENT}