File "files"
This Prolog text provides file system access. The natively
implemented predicates are directory_files/2, file_exists/1,
make_directory/1 and delete_file/1. The predicates are modelled
after GNU Prolog, which means that the predicate file_exists/1
succeeds for regular, directory and other file entries.
The other predicates are bootstrapped from the native predicates
and from core predicates. Since Dogelog Player only supports text
streams, there ore no predicates that can access or modify the
content of binary streams. Nevertheless, predicates such as
copy_time/2 that deal with meta information work also for binary
streams.
The following file predicates are provided:
- directory_files(F, L):
- The predicate succeeds in L with the entries of the directory
F. Barks if path F doesn't exist or if path F doesn't point to
directory.
- file_exists(F):
- The predicate succeeds if the file F exists, otherwise fails.
- make_directory(F):
- The predicate succeeds. As a side effect a directory F is
created. Barks if the parent of F doesn't exist or if F already
exists.
- delete_file(F):
- The predicate succeeds. As a side effect the file F is
deleted. Barks if the file F doesn't exist or if it is a
directory.
- directory_member(F, N):
- The predicate succeeds in N with the files of the directory F.
Barks if path F doesn't ex-ist or if path F doesn't point to
directory.
- ensure_directory(F):
- The predicate succeeds. As a side effect it ensures a
directory F.
- copy_text(A, B):
- copy_text(A, B, O):
- The predicate succeeds. As side effect it copies the file A
into the file B. An already ex-isting file B is silently
overwritten. The ternary predicate allows specifying copy
file options. The following copy file options are
supported:
- append(B): B is the file append flag, default is false.
- copy_binary(A, B):
- copy_binary(A, B, O):
- The predicate succeeds. As side effect it copies the file A
into the file B. An already ex-isting file B is silently
overwritten. The ternary predicate allows specifying copy
file options. The following copy file options are
supported:
- append(B): B is the file append flag, default is false.
- copy_time(A, B):
- copy_time(A, B, O):
- The predicate succeeds. As side effect it copies the last
modified date from file A to the last modified date of file B.
The ternary predicate allows specifying copy time options. The
following copy time options are supported:
- update(B): B is the time update flag, default is false.
Kommentare