Common Lisp Package: META-FILE-SYSTEM

README:

FUNCTION

Public

METADATA-DIRECTORY-P (FILE)

Return true if PATHNAME is a metadata directory. This function may be used by programs that search through a directory tree, to be able to skip metadata directories. The DIRECTORY function in this package does already this.

Private

CHECK-METADATA-CONSISTENCY (PATHNAME)

Remove stray metadata files from directory PATHNAME.

FILE-CLASS-BY-PATHNAME (PATHNAME)

Given a pathname return the class that best represents the kind of file. By default return *DEFAULT-FILE-CLASS*.

READ-METADATA (PATHNAME)

Read the metadata information belonging to PATHNAME file. Return NIL if not available.

REMOVE-EMPTY-METADATA-DIRECTORY (FILE)

Attempt to remove the metadata directory if empty.

Undocumented

FIND-METADATA (SEARCH-PATHS METADATA-MATCHERS)

MAKE-FILE-SYSTEM-OBJECT-FROM-FILE (PATHNAME)

MATCH-PROPERTY-P (FILE KEYWORD MATCH-VALUE)

MACRO

Public

DEFINE-FILE-SYSTEM-OBJECT (NAME SUPER-CLASSES FILENAME-TYPES &REST CLASS-DECLARATIONS)

This is the macro that should be used to declared new classes derived from FILE-SYSTEM-OBJECT. The syntax is similar to defclass with few differences: if no superclass is mentioned it defaults to FILE-SYSTEM-OBJECT; FILENAME-TYPES is the list of file types this class represents. This list is used by MAKE-FILE-SYSTEM-OBJECT-FROM-FILE to automatically instantiate the right object from a pathname. FILENAME-TYPES is a list of strings, pathnames, or functions: strings are matched against pathname-type of the files, pathnames are matched against the whole pathname of files, while the function is called passing the pathname of files. These functions should return true if they recognise the file as of their type.

GENERIC-FUNCTION

Public

COPY-FILE (FILE-SYSTEM-OBJECT NEW-PATH &KEY IF-EXISTS (IF-EXISTS ERROR))

Copy FILE to NEW-PATH preserving its metadata in the copy. Return a new FILE-SYSTEM-OBJECT object.

DELETE-FILE (FILE)

Like CL:DELETE-FILE but takes care of removing the metadata as well.

FS-OBJECT (THING)

Return a FILE-SYSTEM-OBJECT object of THING.

LIST-DIRECTORY (DIRECTORY)

Just like SCLF:LIST-DIRECTORY but this one returns a list of FILE-SYSTEM-OBJECT objects. Care is taken to skip metadata directories and their contents.

METADATA-PATHNAMES (FILE)

Return the list of pathnames of the metadata files associated with FILE.

MOVE-FILE (FILE NEW-PATH &KEY IF-EXISTS (IF-EXISTS ERROR))

Like RENAME-FILE but handle cross-filesystem relocations.

REMOVE-METADATA (FILE)

Permanently remove the metadata from FILE object.

RENAME-FILE (FILE NEW-PATH)

Like CL:RENAME-FILE but polymorphically handle METAFS:FILE-SYSTEM-OBJECTs as well.

Undocumented

METADATA (FILE)

SETFMETADATA (VALUE FILE)

PROPERTY (FILE KEYWORD)

SETFPROPERTY (VALUE FILE KEYWORD)

REMOVE-PROPERTY (FILE KEYWORD)

SAVE-METADATA (FILE)

Private

DELETE-METADATA-FILE (FILE-SYSTEM-OBJECT)

Delete just the file containing the metadata. Don't do anything if metadata file doesn't exist. Return true if the metadata file was deleted otherwise false.

METADATA-DIRECTORY (FILE)

Return the pathname of the directory containing the metadata for FILE.

METADATA-PATHNAME (FILE)

Return the pathname of the metadata file associated with FILE.

Undocumented

LOAD-METADATA (FILE)

SLOT-ACCESSOR

Public

PATHNAME (THING)

The Return a pathname object from THING.

VARIABLE

Public

*AUTO-SAVE*

Whether setting a property or changing any metadata will automatically make the change permanent on the filesystem.

*DEFAULT-FILE-CLASS*

The class that is instantiated by default for an unknown file type. See FILE-CLASS-BY-PATHNAME and MAKE-FILE-SYSTEM-OBJECT-FROM-FILE.

*METADATA-DIRECTORY-NAME*

Name of the directory that contains the metadata files.

Private

*FILE-TYPES-TABLE*

Lookup table for the automatic instantiation of file-system-object class objects. This variable is normally updated by the DEFINE-FILE-SYSTEM-OBJECT macro when defining new types derived from FILE-SYSTEM-OBJECT. This is an alist of strings or function and types. See DEFINE-FILE-SYSTEM-OBJECT for further details.

CLASS

Public

SYSTEM-DIRECTORY

Class that models file system directories.

SYSTEM-FILE

Class that models standard files.

Undocumented

FILE-SYSTEM-OBJECT