| Line 46... |
Line 46... |
| 46 |
The mode will be modified by the \code{umask} setting in the same way
|
46 |
The mode will be modified by the \code{umask} setting in the same way
|
| 47 |
as for the system function \code{mkdir}. What modes can be set is
|
47 |
as for the system function \code{mkdir}. What modes can be set is
|
| 48 |
OS-dependent, and it is unsafe to assume that more than three octal
|
48 |
OS-dependent, and it is unsafe to assume that more than three octal
|
| 49 |
digits will be used. For more details see your OS's documentation on the
|
49 |
digits will be used. For more details see your OS's documentation on the
|
| 50 |
system call \code{mkdir}, e.g. \command{man 2 mkdir} (and not that on
|
50 |
system call \code{mkdir}, e.g. \command{man 2 mkdir} (and not that on
|
| 51 |
the command-line utility of that name).
|
51 |
the command-line utility of that name).
|
| 52 |
#endif
|
52 |
#endif
|
| 53 |
|
53 |
|
| 54 |
One of the idiosyncrasies of Windows is that directory creation may
|
54 |
One of the idiosyncrasies of Windows is that directory creation may
|
| 55 |
report success but create a directory with a different name, for
|
55 |
report success but create a directory with a different name, for
|
| 56 |
example \code{dir.create("G.S.")} creates \file{"G.S"}. This is
|
56 |
example \code{dir.create("G.S.")} creates \file{"G.S"}. This is
|
| 57 |
undocumented, and what are the precise circumstances is unknown (and
|
57 |
undocumented, and what are the precise circumstances is unknown (and
|
| 58 |
might depend on the version of Windows). Also avoid directory names
|
58 |
might depend on the version of Windows). Also avoid directory names
|
| 59 |
with a trailing space.
|
59 |
with a trailing space.
|
| 60 |
%% http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
|
60 |
%% http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29.aspx
|
| 61 |
%% is vague about this!
|
61 |
%% is vague about this!
|
| 62 |
|
62 |
|
| 63 |
\code{Sys.chmod} sets the file permissions of one or more files.
|
63 |
\code{Sys.chmod} sets the file permissions of one or more files.
|
| 64 |
#ifdef unix
|
64 |
#ifdef unix
|
| 65 |
It may not be supported on a system (when a warning is issued).
|
65 |
It may not be supported on a system (when a warning is issued).
|
| 66 |
See the comments for \code{dir.create} for how modes are interpreted.
|
66 |
See the comments for \code{dir.create} for how modes are interpreted.
|
| 67 |
Changing mode on a symbolic link is unlikely to work (nor be
|
67 |
Changing mode on a symbolic link is unlikely to work (nor be
|
| Line 78... |
Line 78... |
| 78 |
file. So \R interprets \code{mode} to mean set read-only if and only
|
78 |
file. So \R interprets \code{mode} to mean set read-only if and only
|
| 79 |
if \code{(mode & 0200) == 0} (interpreted in octal). Windows has a much
|
79 |
if \code{(mode & 0200) == 0} (interpreted in octal). Windows has a much
|
| 80 |
more extensive system of file permissions on some file systems
|
80 |
more extensive system of file permissions on some file systems
|
| 81 |
(e.g. versions of NTFS) which are unrelated to this system call.
|
81 |
(e.g. versions of NTFS) which are unrelated to this system call.
|
| 82 |
#endif
|
82 |
#endif
|
| 83 |
|
83 |
|
| 84 |
\code{Sys.umask} sets the \code{umask} and returns the previous value:
|
84 |
\code{Sys.umask} sets the \code{umask} and returns the previous value:
|
| 85 |
as a special case \code{mode = NA} just returns the current value.
|
85 |
as a special case \code{mode = NA} just returns the current value.
|
| 86 |
#ifdef unix
|
86 |
#ifdef unix
|
| 87 |
It may not be supported (when a warning is issued and \code{"0"}
|
87 |
It may not be supported (when a warning is issued and \code{"0"}
|
| 88 |
is returned). For more details see your OS's documentation on the
|
88 |
is returned). For more details see your OS's documentation on the
|
| Line 97... |
Line 97... |
| 97 |
%% http://msdn.microsoft.com/en-us/library/5axxx3be%28v=vs.80%29.aspx
|
97 |
%% http://msdn.microsoft.com/en-us/library/5axxx3be%28v=vs.80%29.aspx
|
| 98 |
|
98 |
|
| 99 |
How modes are handled depends on the file system, even on Unix-alikes
|
99 |
How modes are handled depends on the file system, even on Unix-alikes
|
| 100 |
(although their documentation is often written assuming a POSIX file
|
100 |
(although their documentation is often written assuming a POSIX file
|
| 101 |
system). So treat documentation cautiously if you are using, say, a
|
101 |
system). So treat documentation cautiously if you are using, say, a
|
| 102 |
FAT/FAT32 or network-mounted file system.
|
102 |
FAT/FAT32 or network-mounted file system.
|
| 103 |
}
|
103 |
}
|
| 104 |
\value{
|
104 |
\value{
|
| 105 |
\code{dir.create} and \code{Sys.chmod} return invisibly a logical vector
|
105 |
\code{dir.create} and \code{Sys.chmod} return invisibly a logical vector
|
| 106 |
indicating if the operation succeeded for each of the files attempted.
|
106 |
indicating if the operation succeeded for each of the files attempted.
|
| 107 |
Using a missing value for a path name will always be regarded as a
|
107 |
Using a missing value for a path name will always be regarded as a
|
| Line 111... |
Line 111... |
| 111 |
for an already existing component for \code{recursive = TRUE}).
|
111 |
for an already existing component for \code{recursive = TRUE}).
|
| 112 |
|
112 |
|
| 113 |
\code{Sys.umask} returns the previous value of the \code{umask},
|
113 |
\code{Sys.umask} returns the previous value of the \code{umask},
|
| 114 |
as a length-one object of class \code{"\link{octmode}"}: the
|
114 |
as a length-one object of class \code{"\link{octmode}"}: the
|
| 115 |
visibility flag is off unless \code{mode} is \code{NA}.
|
115 |
visibility flag is off unless \code{mode} is \code{NA}.
|
| 116 |
|
116 |
|
| 117 |
See also the section in the help for \code{\link{file.exists}} on
|
117 |
See also the section in the help for \code{\link{file.exists}} on
|
| 118 |
case-insensitive file systems for the interpretation of \code{path}
|
118 |
case-insensitive file systems for the interpretation of \code{path}
|
| 119 |
and \code{paths}.
|
119 |
and \code{paths}.
|
| 120 |
}
|
120 |
}
|
| 121 |
#ifdef windows
|
121 |
#ifdef windows
|
| 122 |
\note{
|
122 |
\note{
|
| 123 |
There is no guarantee that these functions will handle Windows
|
123 |
There is no guarantee that these functions will handle Windows
|
| 124 |
relative paths of the form \file{d:path}: try \file{d:./path}
|
124 |
relative paths of the form \file{d:path}: try \file{d:./path}
|
| 125 |
instead. In particular, \file{d:} is not recognized as a directory.
|
125 |
instead. In particular, \file{d:} is not recognized as a directory.
|
| 126 |
Nor are \samp{\\\\?\\} prefixes (and similar) supported.
|
126 |
Nor are \samp{\\\\?\\} prefixes (and similar) supported.
|
| 127 |
|
127 |
|
| 128 |
UTF-8-encoded dirnames not valid in the current locale can be used.
|
128 |
UTF-8-encoded dirnames not valid in the current locale can be used.
|
| 129 |
}
|
129 |
}
|
| 130 |
#endif
|
130 |
#endif
|
| 131 |
|
131 |
|
| 132 |
\author{
|
132 |
\author{
|
| 133 |
Ross Ihaka, Brian Ripley
|
133 |
Ross Ihaka, Brian Ripley
|