| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/basename.Rd
|
1 |
% File src/library/base/man/basename.Rd
|
| 2 |
% Part of the R package, http://www.R-project.org
|
2 |
% Part of the R package, http://www.R-project.org
|
| 3 |
% Copyright 1995-2009 R Core Team
|
3 |
% Copyright 1995-2013 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{basename}
|
6 |
\name{basename}
|
| 7 |
\alias{basename}
|
7 |
\alias{basename}
|
| 8 |
\alias{dirname}
|
8 |
\alias{dirname}
|
| Line 32... |
Line 32... |
| 32 |
\section{Behaviour on Windows}{
|
32 |
\section{Behaviour on Windows}{
|
| 33 |
On Windows this will accept either \code{\\} or \code{/} as the path
|
33 |
On Windows this will accept either \code{\\} or \code{/} as the path
|
| 34 |
separator, but \code{dirname} will return a path using \code{/}
|
34 |
separator, but \code{dirname} will return a path using \code{/}
|
| 35 |
(except if on a network share, when the leading \code{\\\\} will be
|
35 |
(except if on a network share, when the leading \code{\\\\} will be
|
| 36 |
preserved). Expect these only to be able to handle complete
|
36 |
preserved). Expect these only to be able to handle complete
|
| 37 |
paths, and not for example just a share or a drive.
|
37 |
paths, and not for example just a network share or a drive.
|
| 38 |
|
38 |
|
| 39 |
UTF-8-encoded dirnames not valid in the current locale can be used.
|
39 |
UTF-8-encoded path names not valid in the current locale can be used.
|
| 40 |
}
|
40 |
}
|
| 41 |
\note{
|
41 |
\note{
|
| 42 |
These are not wrappers for the POSIX system functions of the same
|
42 |
These are not wrappers for the POSIX system functions of the same
|
| 43 |
names: in particular they do \strong{not} have the special handling of
|
43 |
names: in particular they do \strong{not} have the special handling of
|
| 44 |
the path \code{"/"} and of returning \code{"."} for empty strings in
|
44 |
the path \code{"/"} and of returning \code{"."} for empty strings.
|
| 45 |
\code{basename}.
|
- |
|
| 46 |
}
|
45 |
}
|
| 47 |
\value{
|
46 |
\value{
|
| 48 |
A character vector of the same length as \code{path}. A zero-length
|
47 |
A character vector of the same length as \code{path}. A zero-length
|
| 49 |
input will give a zero-length output with no error.
|
48 |
input will give a zero-length output with no error.
|
| 50 |
|
49 |
|
| - |
|
50 |
Paths not containing any separators are taken to be in the current
|
| - |
|
51 |
directory, so \code{dirname} returns \code{"."}.
|
| - |
|
52 |
|
| 51 |
If an element of \code{path} is \code{\link{NA}}, so is the result.
|
53 |
If an element of \code{path} is \code{\link{NA}}, so is the result.
|
| - |
|
54 |
|
| - |
|
55 |
\code{""} is not a valid pathname, but is returned unchanged.
|
| 52 |
}
|
56 |
}
|
| 53 |
\seealso{
|
57 |
\seealso{
|
| 54 |
\code{\link{file.path}}, \code{\link{path.expand}}.
|
58 |
\code{\link{file.path}}, \code{\link{path.expand}}.
|
| 55 |
}
|
59 |
}
|
| 56 |
\examples{
|
60 |
\examples{
|