/usr/lib/swi-prolog/doc/Manual/files.html is in swi-prolog-nox 5.10.4-3ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>SWI-Prolog 5.11.18 Reference Manual: Section 4.34</TITLE><LINK REL=home HREF="index.html">
<LINK REL=contents HREF="Contents.html">
<LINK REL=index HREF="DocIndex.html">
<LINK REL=summary HREF="summary.html">
<LINK REL=previous HREF="system.html">
<LINK REL=next HREF="toplevel.html">
<STYLE type="text/css">
/* Style sheet for SWI-Prolog latex2html
*/
dd.defbody
{ margin-bottom: 1em;
}
dt.pubdef
{ background-color: #c5e1ff;
}
dt.multidef
{ background-color: #c8ffc7;
}
.bib dd
{ margin-bottom: 1em;
}
.bib dt
{ float: left;
margin-right: 1.3ex;
}
pre.code
{ margin-left: 1.5em;
margin-right: 1.5em;
border: 1px dotted;
padding-top: 5px;
padding-left: 5px;
padding-bottom: 5px;
background-color: #f8f8f8;
}
div.navigate
{ text-align: center;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
}
div.title
{ text-align: center;
padding-bottom: 1em;
font-size: 200%;
font-weight: bold;
}
div.author
{ text-align: center;
font-style: italic;
}
div.abstract
{ margin-top: 2em;
background-color: #f0f0f0;
border: 1px dotted;
padding: 5px;
margin-left: 10%; margin-right:10%;
}
div.abstract-title
{ text-align: center;
padding: 5px;
font-size: 120%;
font-weight: bold;
}
div.toc-h1
{ font-size: 200%;
font-weight: bold;
}
div.toc-h2
{ font-size: 120%;
font-weight: bold;
margin-left: 2em;
}
div.toc-h3
{ font-size: 100%;
font-weight: bold;
margin-left: 4em;
}
div.toc-h4
{ font-size: 100%;
margin-left: 6em;
}
span.sec-nr
{
}
span.sec-title
{
}
span.pred-ext
{ font-weight: bold;
}
span.pred-tag
{ float: right;
padding-top: 0.2em;
font-size: 80%;
font-style: italic;
color: #202020;
}
/* Footnotes */
sup.fn { color: blue; text-decoration: underline; }
span.fn-text { display: none; }
sup.fn span {display: none;}
sup:hover span
{ display: block !important;
position: absolute; top: auto; left: auto; width: 80%;
color: #000; background: white;
border: 2px solid;
padding: 5px; margin: 10px; z-index: 100;
font-size: smaller;
}
</STYLE>
</HEAD>
<BODY BGCOLOR="white">
<DIV class="navigate"><A class="nav" href="index.html"><IMG SRC="home.gif" BORDER=0 ALT="Home"></A>
<A class="nav" href="Contents.html"><IMG SRC="index.gif" BORDER=0 ALT="Contents"></A>
<A class="nav" href="DocIndex.html"><IMG SRC="yellow_pages.gif" BORDER=0 ALT="Index"></A>
<A class="nav" href="summary.html"><IMG SRC="info.gif" BORDER=0 ALT="Summary"></A>
<A class="nav" href="system.html"><IMG SRC="prev.gif" BORDER=0 ALT="Previous"></A>
<A class="nav" href="toplevel.html"><IMG SRC="next.gif" BORDER=0 ALT="Next"></A>
</DIV>
<H2><A NAME="sec:4.34"><SPAN class="sec-nr">4.34</SPAN> <SPAN class="sec-title">File
System Interaction</SPAN></A></H2>
<A NAME="sec:files"></A>
<DL class="latex">
<DT class="pubdef"><A NAME="access_file/2"><STRONG>access_file</STRONG>(<VAR>+File,
+Mode</VAR>)</A></DT>
<DD class="defbody">
True if <VAR>File</VAR> exists and can be accessed by this prolog
process under mode <VAR>Mode</VAR>. <VAR>Mode</VAR> is one of the atoms
<CODE>read</CODE>, <CODE>write</CODE>, <CODE>append</CODE>, <CODE>exist</CODE>, <CODE>none</CODE>
or
<CODE>execute</CODE>. <VAR>File</VAR> may also be the name of a
directory. Fails silently otherwise. <CODE>access_file(File, none)</CODE>
simply succeeds without testing anything.
<P>If `Mode' is <CODE>write</CODE> or <CODE>append</CODE>, this
predicate also succeeds if the file does not exist and the user has
write-access to the directory of the specified location.</DD>
<DT class="pubdef"><A NAME="exists_file/1"><STRONG>exists_file</STRONG>(<VAR>+File</VAR>)</A></DT>
<DD class="defbody">
True if <VAR>File</VAR> exists and is a regular file. This does not
imply the user has read and/or write permission for the file.</DD>
<DT class="pubdef"><A NAME="file_directory_name/2"><STRONG>file_directory_name</STRONG>(<VAR>+File,
-Directory</VAR>)</A></DT>
<DD class="defbody">
Extracts the directory-part of <VAR>File</VAR>. The returned <VAR>Directory</VAR>
name does not end in <CODE><CODE>/</CODE></CODE>. There are two special
cases. The directory-name of <CODE><CODE>/</CODE></CODE> is <CODE><CODE>/</CODE></CODE>
itself and the directory-name if <VAR>File</VAR> does not contain any <CODE><CODE>/</CODE></CODE>
characters is <CODE><CODE>.</CODE></CODE>.</DD>
<DT class="pubdef"><A NAME="file_base_name/2"><STRONG>file_base_name</STRONG>(<VAR>+File,
-BaseName</VAR>)</A></DT>
<DD class="defbody">
Extracts the filename part from a path specification. If <VAR>File</VAR>
does not contain any directory separators, <VAR>File</VAR> is returned.</DD>
<DT class="pubdef"><A NAME="same_file/2"><STRONG>same_file</STRONG>(<VAR>+File1,
+File2</VAR>)</A></DT>
<DD class="defbody">
True if both filenames refer to the same physical file. That is, if <VAR>File1</VAR>
and <VAR>File2</VAR> are the same string or both names exist and point
to the same file (due to hard or symbolic links and/or relative vs.
absolute paths).</DD>
<DT class="pubdef"><A NAME="exists_directory/1"><STRONG>exists_directory</STRONG>(<VAR>+Directory</VAR>)</A></DT>
<DD class="defbody">
True if <VAR>Directory</VAR> exists and is a directory. This does not
imply the user has read, search and or write permission for the
directory.</DD>
<DT class="pubdef"><A NAME="delete_file/1"><STRONG>delete_file</STRONG>(<VAR>+File</VAR>)</A></DT>
<DD class="defbody">
Remove <VAR>File</VAR> from the file system.</DD>
<DT class="pubdef"><A NAME="rename_file/2"><STRONG>rename_file</STRONG>(<VAR>+File1,
+File2</VAR>)</A></DT>
<DD class="defbody">
Rename <VAR>File1</VAR> into <VAR>File2</VAR>. The semantics is
compatible to the POSIX semantics of the rename() system call as far as
the operating system allows. if <VAR>File2</VAR> exists, the operation
succeeds (except for possible permission errors) and is <EM>atomic</EM>
(meaning there is no window where <VAR>File2</VAR> does not exist).</DD>
<DT class="pubdef"><A NAME="size_file/2"><STRONG>size_file</STRONG>(<VAR>+File,
-Size</VAR>)</A></DT>
<DD class="defbody">
Unify <VAR>Size</VAR> with the size of <VAR>File</VAR> in bytes.</DD>
<DT class="pubdef"><A NAME="time_file/2"><STRONG>time_file</STRONG>(<VAR>+File,
-Time</VAR>)</A></DT>
<DD class="defbody">
Unify the last modification time of <VAR>File</VAR> with <VAR>Time</VAR>.
<VAR>Time</VAR> is a floating point number expressing the seconds
elapsed since Jan 1, 1970. See also <A NAME="idx:converttime28:1128"></A><SPAN class="pred-ext">convert_time/[2,8]</SPAN>
and <A NAME="idx:gettime1:1129"></A><A class="pred" href="system.html#get_time/1">get_time/1</A>.</DD>
<DT class="pubdef"><A NAME="absolute_file_name/2"><STRONG>absolute_file_name</STRONG>(<VAR>+File,
-Absolute</VAR>)</A></DT>
<DD class="defbody">
Expand a local file-name into an absolute path. The absolute path is
canonised: references to <CODE>.</CODE> and <CODE>..</CODE> are deleted.
This predicate ensures that expanding a file-name it returns the same
absolute path regardless of how the file is addressed. SWI-Prolog uses
absolute file names to register source files independent of the current
working directory. See also <A NAME="idx:absolutefilename3:1130"></A><A class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</A>.
See also
<A NAME="idx:absolutefilename3:1131"></A><A class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</A>
and <A NAME="idx:expandfilename2:1132"></A><A class="pred" href="files.html#expand_file_name/2">expand_file_name/2</A>.</DD>
<DT class="pubdef"><A NAME="absolute_file_name/3"><STRONG>absolute_file_name</STRONG>(<VAR>+Spec,
+Options, -Absolute</VAR>)</A></DT>
<DD class="defbody">
Converts the given file specification into an absolute path.
<VAR>Option</VAR> is a list of options to guide the conversion:
<DL class="latex">
<DT><STRONG>extensions</STRONG>(<VAR>ListOfExtensions</VAR>)</DT>
<DD class="defbody">
List of file-extensions to try. Default is <CODE>''</CODE>. For each
extension, <A NAME="idx:absolutefilename3:1133"></A><A class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</A>
will first add the extension and then verify the conditions imposed by
the other options. If the condition fails, the next extension of the
list is tried. Extensions may be specified both as <CODE>..ext</CODE> or
plain <CODE>ext</CODE>.</DD>
<DT><STRONG>relative_to</STRONG>(<VAR>+FileOrDir</VAR>)</DT>
<DD class="defbody">
Resolve the path relative to the given directory or directory the
holding the given file. Without this option, paths are resolved relative
to the working directory (see <A NAME="idx:workingdirectory2:1134"></A><A class="pred" href="files.html#working_directory/2">working_directory/2</A>)
or, if <VAR>Spec</VAR> is atomic and <A NAME="idx:absolutefilename23:1135"></A><A class="pred" href="files.html#absolute_file_name/2">absolute_file_name/[2,3]</A>
is executed in a directive, it uses the current source-file as
reference.</DD>
<DT><STRONG>access</STRONG>(<VAR>Mode</VAR>)</DT>
<DD class="defbody">
Imposes the condition access_file(<VAR>File</VAR>, <VAR>Mode</VAR>). <VAR>Mode</VAR>
is on of <CODE>read</CODE>, <CODE>write</CODE>, <CODE>append</CODE>, <CODE>exist</CODE>
or <CODE>none</CODE>. See also <A NAME="idx:accessfile2:1136"></A><A class="pred" href="files.html#access_file/2">access_file/2</A>.</DD>
<DT><STRONG>file_type</STRONG>(<VAR>Type</VAR>)</DT>
<DD class="defbody">
Defines extensions. Current mapping: <CODE>txt</CODE> implies <CODE>['']</CODE>,
<CODE>prolog</CODE> implies <CODE>['.pl', '']</CODE>, <CODE>executable</CODE>
implies
<CODE>['.so', '']</CODE>, <CODE>qlf</CODE> implies <CODE>['.qlf', '']</CODE>
and
<CODE>directory</CODE> implies <CODE>['']</CODE>. The file-type <CODE>source</CODE>
is an alias for <CODE>prolog</CODE> for compatibility with SICStus
Prolog. See also <A NAME="idx:prologfiletype2:1137"></A><A class="pred" href="consulting.html#prolog_file_type/2">prolog_file_type/2</A>.
This predicate only returns non-directories, unless the option <CODE>file_type(directory)</CODE>
is specified.</DD>
<DT><STRONG>file_errors</STRONG>(<VAR>fail/error</VAR>)</DT>
<DD class="defbody">
If <CODE>error</CODE> (default), throw and <CODE>existence_error</CODE>
exception if the file cannot be found. If <CODE>fail</CODE>, stay
silent.<SUP class="fn">70<SPAN class="fn-text">Silent operation was the
default up to version 3.2.6.</SPAN></SUP></DD>
<DT><STRONG>solutions</STRONG>(<VAR>first/all</VAR>)</DT>
<DD class="defbody">
If <CODE>first</CODE> (default), the predicates leaves no choice-point.
Otherwise a choice-point will be left and backtracking may yield more
solutions.</DD>
<DT><STRONG>expand</STRONG>(<VAR>true/false</VAR>)</DT>
<DD class="defbody">
If <CODE>true</CODE> (default is <CODE>false</CODE>) and <VAR>Spec</VAR>
is atomic, call <A NAME="idx:expandfilename2:1138"></A><A class="pred" href="files.html#expand_file_name/2">expand_file_name/2</A>
followed by <A NAME="idx:member2:1139"></A><A class="pred" href="lists.html#member/2">member/2</A>
on <VAR>Spec</VAR> before proceeding. This is a SWI-Prolog extension.
</DD>
</DL>
<P>The Prolog flag <A class="flag" href="flags.html#flag:verbose_file_search">verbose_file_search</A>
can be set to <CODE>true</CODE> to help debugging Prolog's search for
files.
<P>Compatibility considerations with common argument-order in ISO as
well as SICStus <A NAME="idx:absolutefilename3:1140"></A><A class="pred" href="files.html#absolute_file_name/3">absolute_file_name/3</A>
forced us to be flexible here. If the last argument is a list and the
2nd not, the arguments are swapped, making the call <CODE>absolute_file_name(+Spec,
-Path, +Options)</CODE> valid as well.</DD>
<DT class="pubdef"><A NAME="is_absolute_file_name/1"><STRONG>is_absolute_file_name</STRONG>(<VAR>+File</VAR>)</A></DT>
<DD class="defbody">
True if <VAR>File</VAR> specifies and absolute path-name. On Unix
systems, this implies the path starts with a `/'. For Microsoft based
systems this implies the path starts with <CODE><<VAR>letter</VAR>>:</CODE>.
This predicate is intended to provide platform-independent checking for
absolute paths. See also <A NAME="idx:absolutefilename2:1141"></A><A class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</A>
and <A NAME="idx:prologtoosfilename2:1142"></A><A class="pred" href="files.html#prolog_to_os_filename/2">prolog_to_os_filename/2</A>.</DD>
<DT class="pubdef"><A NAME="file_name_extension/3"><STRONG>file_name_extension</STRONG>(<VAR>?Base,
?Extension, ?Name</VAR>)</A></DT>
<DD class="defbody">
This predicate is used to add, remove or test filename extensions. The
main reason for its introduction is to deal with different filename
properties in a portable manner. If the file system is case-insensitive,
testing for an extension will be done case-insensitive too. <VAR>Extension</VAR>
may be specified with or without a leading dot (<CODE><CODE>.</CODE></CODE>).
If an <VAR>Extension</VAR> is generated, it will not have a leading dot.</DD>
<DT class="pubdef"><A NAME="directory_files/2"><STRONG>directory_files</STRONG>(<VAR>+Directory,
-Entries</VAR>)</A></DT>
<DD class="defbody">
Unifies <VAR>Entries</VAR> with a list of entries in <VAR>Directory</VAR>.
Each member of <VAR>Entries</VAR> is an atom denoting an entry relative
to <VAR>Directory</VAR>. <VAR>Entries</VAR> contains all entries,
including hidden files and, if supplied by the OS, the special entries <CODE><CODE>.</CODE></CODE>
and
<CODE>..</CODE>. See also <A NAME="idx:expandfilename2:1143"></A><A class="pred" href="files.html#expand_file_name/2">expand_file_name/2</A>.<SUP class="fn">71<SPAN class="fn-text">This
predicate should be considered a misnomer because it returns entries
rather than files. We stick to this name for compatibility with e.g.,
SICStus, Ciao and YAP.</SPAN></SUP></DD>
<DT class="pubdef"><A NAME="expand_file_name/2"><STRONG>expand_file_name</STRONG>(<VAR>+WildCard,
-List</VAR>)</A></DT>
<DD class="defbody">
Unify <VAR>List</VAR> with a sorted list of files or directories
matching
<VAR>WildCard</VAR>. The normal Unix wildcard constructs `<CODE><CODE>?</CODE></CODE>',
`<CODE><CODE>*</CODE></CODE>', `<CODE>[ ... ]</CODE>' and `<CODE>{...}</CODE>'
are recognised. The interpretation of `<CODE>{...}</CODE>' is
interpreted slightly different from the C shell (csh(1)). The comma
separated argument can be arbitrary patterns, including `<CODE>{...}</CODE>'
patterns. The empty pattern is legal as well: `<CODE>{.pl,}</CODE>'
matches either `<CODE>.pl</CODE>' or the empty string.
<P>If the pattern contains wildcard characters, only existing files and
directories are returned. Expanding a `pattern' without wildcard
characters returns the argument, regardless on whether or not it exists.
<P>Before expanding wildcards, the construct <CODE>$<VAR>var</VAR></CODE>
is expanded to the value of the environment variable <VAR>var</VAR> and
a possible leading <CODE>~</CODE> character is expanded to the user's
home directory.<SUP class="fn">72<SPAN class="fn-text">On Windows, the
home directory is determined as follows: if the environment variable <CODE>HOME</CODE>
exists, this is used. If the variables <CODE>HOMEDRIVE</CODE> and <CODE>HOMEPATH</CODE>
exist (Windows-NT), these are used. At initialisation, the system will
set the environment variable <CODE>HOME</CODE> to point to the
SWI-Prolog home directory if neither <CODE>HOME</CODE> nor <CODE>HOMEPATH</CODE>
and <CODE>HOMEDRIVE</CODE> are defined</SPAN></SUP>.</DD>
<DT class="pubdef"><A NAME="prolog_to_os_filename/2"><STRONG>prolog_to_os_filename</STRONG>(<VAR>?PrologPath,
?OsPath</VAR>)</A></DT>
<DD class="defbody">
Converts between the internal Prolog pathname conventions and the
operating-system pathname conventions. The internal conventions are Unix
and this predicates is equivalent to =/2 (unify) on Unix systems. On DOS
systems it will change the directory-separator, limit the filename
length map dots, except for the last one, onto underscores.</DD>
<DT class="pubdef"><A NAME="read_link/3"><STRONG>read_link</STRONG>(<VAR>+File,
-Link, -Target</VAR>)</A></DT>
<DD class="defbody">
If <VAR>File</VAR> points to a symbolic link, unify <VAR>Link</VAR> with
the value of the link and <VAR>Target</VAR> to the file the link is
pointing to.
<VAR>Target</VAR> points to a file, directory or non-existing entry in
the file system, but never to a link. Fails if <VAR>File</VAR> is not a
link. Fails always on systems that do not support symbolic links.</DD>
<DT class="pubdef"><span class="pred-tag">[deprecated]</span><A NAME="tmp_file/2"><STRONG>tmp_file</STRONG>(<VAR>+Base,
-TmpName</VAR>)</A></DT>
<DD class="defbody">
Create a name for a temporary file. <VAR>Base</VAR> is an identifier for
the category of file. The <VAR>TmpName</VAR> is guaranteed to be unique.
If the system halts, it will automatically remove all created temporary
files.
<VAR>Base</VAR> is used as part of the final filename. Portable
applications should limit themselves to alphanumerical characters.
<P>Because it is possible to guess the generated filename, attackers may
create the filesystem entry as a link and possibly create a security
issue. New code should use <A NAME="idx:tmpfilestream3:1144"></A><A class="pred" href="files.html#tmp_file_stream/3">tmp_file_stream/3</A>.</DD>
<DT class="pubdef"><A NAME="tmp_file_stream/3"><STRONG>tmp_file_stream</STRONG>(<VAR>+Encoding,
-FileName, -Stream</VAR>)</A></DT>
<DD class="defbody">
Create a temporary file name <VAR>FileName</VAR> and open it for writing
in the given <VAR>Encoding</VAR>. <VAR>Encoding</VAR> is a text-encoding
name or
<CODE>binary</CODE>. <VAR>Stream</VAR> is the output stream. If the OS
supports it, the created file is only accessible to the current user. If
the OS supports it, the file is created using the open()-flag <CODE>O_EXCL</CODE>,
which guarantees that the file did not exist before this call. This
predicate is a safe replacement of <A NAME="idx:tmpfile2:1145"></A><A class="pred" href="files.html#tmp_file/2">tmp_file/2</A>.
Note that in those cases where the temporary file is needed to store
output from an external command, the file must be closed first. E.g.,
the following downloads a file from a URL to a temporary file and opens
the file for reading (On Unix systems you can delete the file after
opening it for reading for cleanup):
<PRE class="code">
open_url(URL, In) :-
tmp_file_stream(text, File, Stream),
close(Stream),
process_create(curl, ['-o', File, URL], []),
open(File, read, In),
delete_file(File). % Unix-only
</PRE>
<P>Temporary files created using this call are removed if the Prolog
process terminates. Calling <A NAME="idx:deletefile1:1146"></A><A class="pred" href="files.html#delete_file/1">delete_file/1</A>
using <VAR>FileName</VAR> removes the file and removes the entry from
the administration of files-to-be-deleted.</DD>
<DT class="pubdef"><A NAME="make_directory/1"><STRONG>make_directory</STRONG>(<VAR>+Directory</VAR>)</A></DT>
<DD class="defbody">
Create a new directory (folder) on the filesystem. Raises an exception
on failure. On Unix systems, the directory is created with default
permissions (defined by the process <EM>umask</EM> setting).</DD>
<DT class="pubdef"><A NAME="delete_directory/1"><STRONG>delete_directory</STRONG>(<VAR>+Directory</VAR>)</A></DT>
<DD class="defbody">
Delete directory (folder) from the filesystem. Raises an exception on
failure. Please note that in general it will not be possible to delete a
non-empty directory.</DD>
<DT class="pubdef"><A NAME="working_directory/2"><STRONG>working_directory</STRONG>(<VAR>-Old,
+New</VAR>)</A></DT>
<DD class="defbody">
Unify <VAR>Old</VAR> with an absolute path to the current working
directory and change working directory to <VAR>New</VAR>. Use the
pattern
<CODE>working_directory(CWD, CWD)</CODE> to get the current directory.
See also <A NAME="idx:absolutefilename2:1147"></A><A class="pred" href="files.html#absolute_file_name/2">absolute_file_name/2</A>
and <A NAME="idx:chdir1:1148"></A><A class="pred" href="files.html#chdir/1">chdir/1</A>.<SUP class="fn">bug<SPAN class="fn-text">Some
of the file-I/O predicates use local filenames. Changing directory while
file-bound streams are open causes wrong results on <A NAME="idx:telling1:1149"></A><A class="pred" href="IO.html#telling/1">telling/1</A>, <A NAME="idx:seeing1:1150"></A><A class="pred" href="IO.html#seeing/1">seeing/1</A>
and <A NAME="idx:currentstream3:1151"></A><A class="pred" href="IO.html#current_stream/3">current_stream/3</A></SPAN></SUP>
Note that the working directory is shared between all threads.</DD>
<DT class="pubdef"><A NAME="chdir/1"><STRONG>chdir</STRONG>(<VAR>+Path</VAR>)</A></DT>
<DD class="defbody">
Compatibility predicate. New code should use <A NAME="idx:workingdirectory2:1152"></A><A class="pred" href="files.html#working_directory/2">working_directory/2</A>.
</DD>
</DL>
<P></BODY></HTML>
|