Copyright (C) 2000-2012 |
GNU Info (librep.info)File NamesFile Names ---------- A "file name" is a string identifying an individual file (or directory) in the filing system (i.e. the disk). The exact syntax of file names depends on the operating system. There are several functions for manipulating file names. - Function: file-name-absolute-p file-name Returns true when FILE-NAME is not specified relative to the current directory. - Function: file-name-directory file-name This function returns the directory part of the file name string FILE-NAME. This is the substring of FILE-NAME defining the directory containing the file. (file-name-directory "/tmp/foo") => "/tmp/" (file-name-directory "foo") => "" (file-name-directory "foo/bar/") => "foo/bar/" - Function: file-name-nondirectory file-name Returns the substring of the file name FILE-NAME which is _not_ the directory part. (file-name-nondirectory "/tmp/foo") => "foo" (file-name-nondirectory "foo") => "foo" (file-name-nondirectory "foo/bar/") => "" - Function: file-name-as-directory file-name Returns a string through which the item in the file system named by FILE-NAME can be referred to as a directory. (file-name-as-directory "./foo") => "./foo/" (file-name-as-directory "./foo/") => "./foo/" - Function: directory-file-name directory-name Returns a string through which the directory named by DIRECTORY-NAME can be referred to as a file. (directory-file-name "./foo/") => "./foo" (directory-file-name "./foo") => "./foo" - Function: expand-file-name file-name #!optional base-dir Expands FILE-NAME assuming that it specifies a file relative to BASE-DIR. If BASE-DIR is undefined it is taken as the current value of the `default-directory' variable. While expanding the file name, any obvious simplifications will be performed (e.g. on Unix the removal of "." and ".." where possible). Note that the returned file name will only be absolute if one of the following conditions is met: 1. BASE-DIR (or `default-directory') is absolute, 2. FILE-NAME is already absolute. (expand-file-name "foo" "./bar") => "bar/foo" Note for file handler implementors: when a handler is called for the `expand-file-name' operation, it will only ever receive one argument, the already expanded file name. The only action that may be need to be taken is to simplify the file name (e.g. removing `.' and `..' entries or whatever). - Function: canonical-file-name file-name This function returns the canonical name of the file referred to by the string FILE-NAME. The canonical name of a file is defined such that two files can be compared simply by comparing their canonical names; if the names match, they refer to the same file. (Note that the opposite isn't always true, if two canonical names don't match the files could still be the same, for example via hard links. On most operating systems, symbolic links will be expanded where possible. (canonical-file-name "foo") => "/home/john/src/librep/man/foo" - Function: local-file-name file-name `librep' supports extensible file handling (Note: File Handlers), so file names may refer to files not residing in the system's local file structure, and thus which are unavailable to other programs. This function returns either the absolute name of the file FILE-NAME, if it is found in the local system, or false, if the file does not. (local-file-name "foo") => "/home/john/src/librep/man/foo" (local-file-name "/john@tango:foo") => () - Function: make-temp-name This function returns the name of a file which, when created, may be used for temporary storage. Each time this function is called a unique name is computed. (make-temp-name) => "/tmp/00088aaa" (make-temp-name) => "/tmp/00088baa" - Variable: default-directory This variable names the current working directory. All relative file names are interpreted starting from this location in the file system. automatically generated by info2www version 1.2.2.9 |