class FileRef

A FileRef is an object representing a file in the file system in a platform-independent manner.

Properties

name
Name of the file. On platforms where files are specified by means of a pathname, this is the last pathname component.
dir
DirRef representing the directory in which the file resides, or will reside in the case of a file which does not yet exist.

Methods

open(mode, file_type = None)
Opens the referenced file using the given mode (which is the same as the mode parameter to the built-in open function). If opening for writing and the file does not yet exist, it is created.

If file_type is given, it should be a FileType instance specifying the file type metadata to be attached to the file. This parameter is only used if the call results in the creation of a new file. On platforms which do not have file type metadata, it is ignored.

---