Avidemux 2.6 Scripting Reference
 All Classes Functions Enumerations Enumerator Properties Groups Pages
Public Member Functions | Properties | List of all members
FileInformation Class Reference

The FileInformation class provides system-independent file information. More...

Public Member Functions

Boolean exists ()
 Returns true if the file exists; otherwise returns false.
 FileInformation (String file)
 Constructs a new FileInformation that gives information about the given file.
 FileInformation (File file)
 Constructs a new FileInformation that gives information about file.
 FileInformation (Directory directory, String file)
 Constructs a new FileInformation that gives information about the given file in the specified directory.
Boolean isAbsolute ()
 Returns true if the file path name is absolute, otherwise returns false if the path is relative.
Boolean isBundle ()
 Returns true if this object points to a bundle or to a symbolic link to a bundle on Mac OS X; otherwise returns false.
Boolean isDirectory ()
 Returns true if this object points to a directory or to a symbolic link to a directory; otherwise returns false.
Boolean isExecutable ()
 Returns true if the file is executable; otherwise returns false.
Boolean isFile ()
 Returns true if this object points to a file or to a symbolic link to a file.
Boolean isHidden ()
 Returns true if this is a `hidden' file; otherwise returns false.
Boolean isReadable ()
 Returns true if the user can read the file; otherwise returns false.
Boolean isRelative ()
 Returns true if the file path name is relative, otherwise returns false if the path is absolute (e.g. under Unix a path is absolute if it begins with a "/").
Boolean isRoot ()
 Returns true if the object points to a directory or to a symbolic link to a directory, and that directory is the root directory; otherwise returns false.
Boolean isSymLink ()
 Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise returns false.
Boolean isWritable ()
 Returns true if the user can write to the file; otherwise returns false.
Boolean makeAbsolute ()
 Converts the file's path to an absolute path if it is not already in that form.
Boolean permission (File::Permission permissions)
 Tests for file permissions.
void refresh ()
 Refreshes the information about the file, i.e. reads in information from the file system the next time a cached property is fetched.

Properties

Directory absoluteDirectory
 Returns the file's absolute path as a Directory object.
String absoluteFilePath
 Returns an absolute path including the file name.
String absolutePath
 Returns a file's path absolute path. This doesn't include the file name.
String baseName
 Returns the base name of the file without the path.
String bundleName
 Returns the name of the bundle.
Boolean caching
 Returns true if caching is enabled; otherwise returns false.
String canonicalFilePath
 Returns the canonical path including the file name, i.e. an absolute path without symbolic links or redundant "." or ".." elements.
String canonicalPath
 Returns the file's path canonical path (excluding the file name), i.e. an absolute path without symbolic links or redundant "." or ".." elements.
String completeBaseName
 Returns the complete base name of the file without the path.
String completeSuffix
 Returns the complete suffix of the file.
Date created
 Returns the date and time when the file was created.
Directory directory
 Returns the path of the object's parent directory as a Directory object.
String fileName
 Returns the name of the file, excluding the path.
String filePath
 Returns the file name, including the path (which may be absolute or relative).
String group
 Returns the group of the file.
Number groupId
 Returns the id of the group the file belongs to.
Date lastModified
 Returns the date and time when the file was last modified.
Date lastRead
 Returns the date and time when the file was last read (accessed).
String owner
 Returns the owner of the file.
Number ownerId
 Returns the id of the owner of the file.
String path
 Returns the file's path. This doesn't include the file name.
File::Permission permissions
 Returns the complete OR-ed together combination of File::Permission for the file.
Number size
 Returns the file size in bytes. If the file does not exist or cannot be fetched, 0 is returned.
String suffix
 Returns the suffix of the file.
String symLinkTarget
 Returns the absolute path to the file or directory a symlink (or shortcut on Windows) points to, or a an empty string if the object isn't a symbolic link.

Detailed Description

The FileInformation class provides system-independent file information.

Examples:
TranscodeDirectory.admjs.

Constructor & Destructor Documentation

FileInformation ( String  file)

Constructs a new FileInformation that gives information about the given file.

The file can also include an absolute or relative path.

FileInformation ( File  file)

Constructs a new FileInformation that gives information about file.

If the file has a relative path, the FileInformation will also have a relative path.

FileInformation ( Directory  directory,
String  file 
)

Constructs a new FileInformation that gives information about the given file in the specified directory.

If directory has a relative path, the FileInformation will also have a relative path. If file is an absolute path, then the directory specified will be disregarded.

Member Function Documentation

Boolean exists ( )

Returns true if the file exists; otherwise returns false.

Note: If the file is a symlink that points to a non existing file, false is returned.

Boolean isFile ( )

Returns true if this object points to a file or to a symbolic link to a file.

Returns false if the object points to something which isn't a file, such as a directory.

Boolean isHidden ( )

Returns true if this is a `hidden' file; otherwise returns false.

Note: This function returns true for the special entries "." and ".." on Unix, even though Directory::entryList treats them as shown.

Boolean isSymLink ( )

Returns true if this object points to a symbolic link (or to a shortcut on Windows); otherwise returns false.

On Unix (including Mac OS X), opening a symlink effectively opens the link's target. On Windows, it opens the .lnk file itself.

Boolean makeAbsolute ( )

Converts the file's path to an absolute path if it is not already in that form.

Returns
Returns true to indicate that the path was converted; otherwise returns false to indicate that the path was already absolute.
Boolean permission ( File::Permission  permissions)

Tests for file permissions.

The permissions argument can be several flags of type File::Permission OR-ed together to check for permission combinations.

Property Documentation

String absoluteFilePath
read

Returns an absolute path including the file name.

The absolute path name consists of the full path and the file name. On Unix this will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'. FileInformation will uppercase drive letters. Note that Directory does not do this.

This function returns the same as FileInformation::filePath, unless FileInformation::isRelative is true. In contrast to FileInformation::canonicalFilePath, symbolic links or redundant "." or ".." elements are not necessarily removed.

String absolutePath
read

Returns a file's path absolute path. This doesn't include the file name.

On Unix the absolute path will always begin with the root, '/', directory. On Windows this will always begin 'D:/' where D is a drive letter, except for network shares that are not mapped to a drive letter, in which case the path will begin '//sharename/'.

In contrast to FileInformation::canonicalPath symbolic links or redundant "." or ".." elements are not necessarily removed.

String baseName
read

Returns the base name of the file without the path.

The base name consists of all characters in the file up to (but not including) the first '.' character.

String bundleName
read

Returns the name of the bundle.

On Mac OS X this returns the proper localized name for a bundle if the path FileInformation::isBundle. On all other platforms an empty String is returned.

String canonicalFilePath
read

Returns the canonical path including the file name, i.e. an absolute path without symbolic links or redundant "." or ".." elements.

An empty string is returned if the file does not exist.

String canonicalPath
read

Returns the file's path canonical path (excluding the file name), i.e. an absolute path without symbolic links or redundant "." or ".." elements.

An empty string is returned if the file does not exist.

String completeBaseName
read

Returns the complete base name of the file without the path.

The complete base name consists of all characters in the file up to (but not including) the last '.' character.

String completeSuffix
read

Returns the complete suffix of the file.

The complete suffix consists of all characters in the file after (but not including) the first '.'.

Date created
read

Returns the date and time when the file was created.

On most Unix systems, this function returns the time of the last status change. A status change occurs when the file is created, but it also occurs whenever the user writes or sets inode information (for example, changing the file permissions).

If neither creation time nor "last status change" time are available, returns the same as FileInformation::lastModified.

Directory directory
read

Returns the path of the object's parent directory as a Directory object.

Note: The Directory returned always corresponds to the object's parent directory, even if the FileInformation represents a directory.

String group
read

Returns the group of the file.

On Windows, on systems where files do not have groups, or if an error occurs, an empty string is returned. This function can be time consuming under Unix (in the order of milliseconds).

Number groupId
read

Returns the id of the group the file belongs to.

On Windows and on systems where files do not have groups this function always returns -2.

Date lastRead
read

Returns the date and time when the file was last read (accessed).

On platforms where this information is not available, returns the same as FileInformation::lastModified.

String owner
read

Returns the owner of the file.

On systems where files do not have owners, or if an error occurs, an empty string is returned. This function can be time consuming under Unix (in the order of milliseconds).

Number ownerId
read

Returns the id of the owner of the file.

On Windows and on systems where files do not have owners this function returns -2.

String path
read

Returns the file's path. This doesn't include the file name.

Note that, if this FileInformation object is given a path ending in a slash, the name of the file is considered empty and this function will return the entire path.

String suffix
read

Returns the suffix of the file.

The suffix consists of all characters in the file after (but not including) the last '.'.

String symLinkTarget
read

Returns the absolute path to the file or directory a symlink (or shortcut on Windows) points to, or a an empty string if the object isn't a symbolic link.

This name may not represent an existing file; it is only a string. FileInformation::exists returns true if the symlink points to an existing file.