class Files.FileType
The FileType class provides a multi-platform representation of a file
type, holding the metadata used by the various platforms to create and
recognise files of a particular type. FileType instances are used by
the standard file selection dialogs to restrict the set of selectable files, and by the FileRef class to enable creating a file of a
specified type.
Properties
- name
- A short human-readable description of the file type.
- suffix
- Filename suffix (without dot) used to recognise files of this
type. This is the most generic way of specifying a file type, as it
works across most platforms.
- This property is used by request_old_file() to filter the set of files that can be selected, and by request_new_file() to determine the suffix of the returned filename. Note, however, that it is ignored by FileRef.open()
when creating a file. If you use a filename other than one returned by
request_new_file(), it is your responsibility to add any
necessary suffix.
- mac_creator
- On the Macintosh, the 4-character creator code to be given to
newly-created files of this type. This property is used by FileRef.open() when creating a file, but not by the file dialog functions.
On other platforms, this property is ignored.
- mac_type
- On the Macintosh, the 4-character type code. This property is
used by FileRef.open() when creating a file, and by request_old_file() to filter the set of files that can be selected.
On other platforms, this property is ignored.
- mac_force_suffix
- On MacOSX, this property controls whether files saved as this type are forced to have the specified suffix even when a mac_type
is specified. The default is true, which ensures that the application
will always recognise saved files as being of this type on all
platforms.
By specifying a mac_type and setting this property to false, you can
allow files to be saved on the Macintosh with any file name. On the
Macintosh their type will be recognised by the mac_type, and files
saved on other platforms will be recognised by their suffix. However,
to ensure that files saved on the Macintosh will be recognised on other
platforms, you will need to manually give them the correct suffix.
This property only applies when the file type specifies both a suffix
and a mac_type. When there is no mac_type, the suffix is always
enforced. When there is no suffix, this property is ignored (since
there is no suffix to enforce).
On non-Macintosh platforms, this property is ignored, and the suffix, if any, is always enforced.
---