The fileInfo Lambda provides system-independent file information. A fileInfo Lambda provides information about a file's name and position (path) in the file system, its access rights and whether it is a directory or symbolic link, etc. The file's size and last modified/read times are also available. A fileInfo can point to a file with either a relative or an absolute file path. Absolute file paths begin with the directory separator "/" (or with a drive specification on Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current working directory. An example of an absolute path is the string "/tmp/quartz". A relative path might look like "src/fatlib". You can use fileInfo.isRelative to check whether a fileInfo is using a relative or an absolute file path. Use fileInfo.convertToAbs to convert a relative fileInfo's path to an absolute path. The file that the fileInfo works on is set in the constructor or later with fileInfo.setFile. Use fileInfo.exists to see if the file exists and fileInfo.size to get its size.
To speed up performance, fileInfo caches information about the file. Because files can be changed by other users or programs, or even by other parts of the same program, use fileInfo.refresh to refresh file information. If you want to switch off a fileInfo's caching and force it to access the file system every time you request information from it call (fileInfo.setCaching false). The file's type is obtained with fileInfo.isFile, isDir and isSymLink. The fileInfo.readLink function provides the name of the file the symlink points to. Elements of the file's name can be extracted with fileInfo.dirPath and fileInfo.fileName. The fileName's parts can be extracted with fileInfo.baseName and fileInfo.extension. The file's dates are returned by fileInfo.created, fileInfo.lastModified and fileInfo.lastRead. Information about the file's access permissions is obtained with fileInfo.isReadable, fileInfo.isWritable and fileInfo.isExecutable. The file's ownership is available from fileInfo.owner, fileInfo.ownerId, fileInfo.group and fileInfo.groupId. You can examine a file's permissions and ownership in a single statement using fileInfo.permission.
If you need to read and traverse directories, see the browseLib.dir Lambda.
This Lambda surfaces the full functionality of the QFileInfo object. Most of the functionality of this Lambda resides in the AIS glueLayer and is accessed by calls to the _AISQFileInfo function. When you create a new fileInfo instance, a corrosponding QFileInfo C++ object is created. Calls to child Lambdas of the fileInfo Lambda result in corrosponding calls to the member functions of the C++ QFileInfo object. All of these calls are made through the _AISQFileInfo function.
A child Lambda called "free" is provided to force the early destruction of the underlying C++ QDir object prior to garbage collection of a dir Lambda. The C++ object will always be destroyed when the Lambda that created it is garbage collected.
Extensions to underlying QDir object (features not in the underlying QDir object):
See getFileInfoStructure - this child Lambda returns a file information structure.
Overview
Returns the 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/'.
This Lambda returns the same as fileInfo.filePath, unless fileInfo.isRelative
is TRUE. If the fileInfo is empty it returns dir.currentDirPath.
This function can be time consuming under Unix (in the order of milliseconds).
See also fileInfo.isRelative and fileInfo.filePath.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.absFilePath)
Arguments
Returns | String | Absolute path including file name. |
---|
When To Use
Use this child Lambda only on an instance of a dir Lambda.
Examples
;;*********************************** ;; Find the absolute path of a file ;;*********************************** (defun Ex_browseLib_fileInfo_absFilePath_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.absFilePath)) ;;-> C:/Ais/astarutp.sl true) ;Execute in the console: ;(Ex_browseLib_fileInfo_absFilePath_1)
Notes & Hints
No special notes.
Overview
Returns the base name of the file.
See also fileInfo.fileName and fileInfo.extension.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.baseName) (fileInfoInstance.baseName true) ; Recommended usage
Arguments
complete | Boolean - optional default=false | If complete is False (the default) the base name consists of all characters in the file name up to (but not including) the first '.' character. If complete is TRUE the base name consists of all characters in the file name up to (but not including) the last '.' character. The path is not included in either case. |
---|---|---|
Returns | String | The base name of the file. |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;**************************** ;; Get the base name of a file ;;**************************** (defun Ex_browseLib_fileInfo_baseName_1() vars:(f) (setq f (new browseLib.fileInfo "some.really.long.filename.sl")) (writeln (f.baseName)) ;;-> some (writeln (f.baseName true)) ;;-> some.really.long.filename true) ;Execute in the console: ;(Ex_browseLib_fileInfo_baseName_1)
Notes & Hints
Be very careful to provide the complete argument in most cases. The default complete value of false is counter intuitive for most applciations.
Overview
Returns true if caching is enabled otherwise returns false.
See also fileInfo.setCaching and fileInfo.refresh.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.caching )
Arguments
Returns | Boolean | Returns true if caching is enabled otherwise returns false. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;***************************************** ;; Get the caching state of the file object ;;***************************************** (defun Ex_browseLib_fileInfo_caching_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.caching)) ;;-> true (f.setCaching false) (writeln (f.caching)) ;;-> false true) ;Execute in the console: ;(Ex_browseLib_fileInfo_caching_1)
Notes & Hints
No special notes.
Overview
Returns true. This Lambda converts the file's path to an absolute path.
If it is already absolute, nothing is done.
See also fileInfo.filePath and fileInfo.isRelative.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.convertToAbs)
Arguments
Returns | Boolean | True |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;***************************************** ;; Convert a files path to an absolute path ;;***************************************** (defun Ex_browseLib_fileInfo_convertToAbs_1() vars:(d f) (setq d (new browseLib.dir)); get current directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.filePath)) ;--> ./astartup.sl (f.convertToAbs) (writeln (f.filePath)) ;--> C:/Ais/astartup.sl true) ;Execute in the console: ;(Ex_browseLib_fileInfo_convertToAbs_1)
Notes & Hints
No special notes.
Overview
Returns the date and time when the file was created.
On platforms where this information is not avaialble, returns the same
as fileInfo.lastModified.
See also fileInfo.lastModified and fileInfo.lastRead.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.created)
Arguments
Returns | Date | Returns a date time. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************************** ;; Get the date a file was created ;;********************************** (defun Ex_browseLib_fileInfo_created_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.created)) ;--> #Mar,23,2004:11:24:49 true) ;Execute in the console: ;(Ex_browseLib_fileInfo_created_1)
Notes & Hints
No special notes.
Overview
dir Arguments absPath - optional boolean (default false) Returns a dir Lambda instance for the file's path. If the fileInfo Lambda is relative and the absPath is false, the dir will be relative otherwise it will be absolute. See also fileInfo.dirPath, fileInfo.fileName and fileInfo.isRelative.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.dir) (fileInfoInstance.dir true)
Arguments
absPath | Boolean - optional default=false | If the fileInfo Lambda is relative and the absPath is false, the dir will be relative otherwise it will be absolute. |
---|---|---|
Returns | dir Object | Returns a dir Lambda instance for the file's path. |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************************* ;; Get the files current directory ;;********************************* (defun Ex_browseLib_fileInfo_dir_1() vars:(d d2 f) (setq d (new browseLib.dir _ais.nstallPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (setq d2 (f.dir true)) (writeln "d.absPath =" (d.absPath)) ;;-> C:/Ais (writeln "d2.absPath=" (d2.absPath));;-> C:/Ais true) ;Execute in the console: ;(Ex_browseLib_fileInfo_dir_1)
Notes & Hints
No special notes.
Overview
Returns file's path.
See also fileInfo.dir, fileInfo.filePath, fileInfo.fileName and fileInfo.isRelative.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.dirPath) (fileInfoInstance.dirPath true)
Arguments
absPath | Boolean - optional default=false | If the absPath is true an absolute path is returned. |
---|---|---|
Returns | String | File's path. |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Return file's path ;;********************** (defun Ex_browseLib_fileInfo_dirPath_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.dirPath true)) ;;-> C:/Ais true) ;Execute in the console: ;(Ex_browseLib_fileInfo_dirPath_1)
Notes & Hints
No special notes.
Overview
Returns true if the file exists otherwise returns false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.exists)
Arguments
Returns | Boolean | True if file exists otherwise false. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;************************ ;; Check if a file exists ;;************************ (defun Ex_browseLib_fileInfo_exists_1() vars:(d f) (setq d (new browseLib.dir _ais._installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.exists)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_exists_1)
Notes & Hints
No special notes.
Overview
Returns the file's extension.
See also fileInfo.fileName and fileInfo.baseName.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.extension) (fileInfoInstance.extension true)
Arguments
complete | Boolean | If complete is true (the default), extension returns the string of all characters in the file name after (but not including) the first '.' character. If complete is false, extension returns the string of all characters in the file name after (but not including) the last '.' character. |
---|---|---|
Returns | String | Returns the files extension. |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Get file's extension ;;********************** (defun Ex_browseLib_fileInfo_extension_1() vars:(f) (setq f (new browseLib.fileInfo "some.really.long.file.name.sl")) (writeln (f.extension false)) ;;-> sl (writeln (f.extension)) ;;-> really.long.file.name.sl true) ;Execute in the console: ;(Ex_browseLib_fileInfo_extension_1)
Notes & Hints
No special notes.
Overview
Returns the name of the file, excluding the path.
See also fileInfo.isRelative, fileInfo.filePath, fileInfo.basename and fileInfo.extension.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.fileName)
Arguments
Returns | String | Name of file excluding the path. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Get file's name ;;********************** (defun Ex_browseLib_fileInfo_fileName_1() vars:(f) (setq f (new browseLib.fileInfo "astartup.sl")) (writeln (f.fileName)) ;;-> astartup.sl true) ;Execute in the console: ;(Ex_browseLib_fileInfo_fileName_1)
Notes & Hints
No special notes.
Overview
Returns the file anme, including the path (which may be absolute or relative).
See also fileInfo.isRelative and fileInfo.absFilePath.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.filePath)
Arguments
Returns | String | File's path. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
No special circumstances.
Examples
;;********************** ;; Get file's path ;;********************** (defun Ex_browseLib_fileInfo_filePath_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.filePath)) ;;-> C:/Ais/astartup.sl true) ;Execute in the console: ;(Ex_browseLib_fileInfo_filePath_1)
Notes & Hints
No special notes.
Overview
Returns a structure containing information on the fileInfo object. NOTE: This function has no counterpart in the underlying QFileInfo object.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.getFileInfoStructure)
Arguments
Returns | Structure | Returns a structure containing some of the available file attributes. See notes below. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;************************************ ;; Get file information as a structure ;;************************************ (defun Ex_browseLib_fileInfo_getFileInfoStructure_1() vars:(d f s n N) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (setq s (f.getFileInfoStructure)) (loop for n from 0 until (length s) do (writeln s[n 0] "=" s[n 1])) ;;-> Type=File ;;-> FileName=astartup.sl ;;-> Size=1838 ;;-> Extension=sl ;;-> FilePath=C:/AisDev/astartup.sl ;;-> Created=#Jul,4,2003:14:36:38 ;;-> Exists=true ;;-> Group=None ;;-> GroupId=-2 ;;-> Executable=true ;;-> Hidden=false ;;-> Readable=true ;;-> Relative=false ;;-> SymLink=false ;;-> Writable=true ;;-> Modified=#Jul,29,2003:08:21:38 ;;-> Read=#Mar,31,2004:20:38:20 ;;-> Owner=Administrators ;;-> OwnerId=-2 ;;-> Link= true) ;Execute in the console: ;(Ex_browseLib_fileInfo_getFileInfoStructure_1)
Notes & Hints
No special notes.
Overview
Returns the group of the file. On Windows, on systems where files do not have
groups, or if an error occurs, None is returned. This Function can be time consuming
under Unix (in the order of milliseconds).
See also fileInfo.groupId, fileInfo.owner and fileInfo.ownerId.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.group)
Arguments
Returns | Integer or #void | File's group. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Get file's group. ;;********************** (defun Ex_browseLib_fileInfo_group_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.group)) ;;-> None - Windows OS does not support groups true) ;Execute in the console: ;(Ex_browseLib_fileInfo_group_1)
Notes & Hints
No special notes.
Overview
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.
See also fileInfo.group, fileInfo.owner and fileInfo.ownerId.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.groupId)
Arguments
Returns | Integer | Group Id or -2 on Windows. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Get file's group id ;;********************** (defun Ex_browseLib_fileInfo_groupId_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.groupId)) ;;-> -2 true) ;Execute in the console: ;(Ex_browseLib_fileInfo_groupId_1)
Notes & Hints
No special notes.
Overview
Returns true if this object points to a directory or to a symbolic link to a directory otherwise returns false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isDir)
Arguments
Returns | Boolean | True if object points to a directory - otherwise false. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;***************************************** ;; Check if fileInfo object is a directory ;;***************************************** (defun Ex_browseLib_fileInfo_isDir_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isDir)) ;;-> false true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isDir_1)
Notes & Hints
No special notes.
Overview
Returns true if this file is executable otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isExecutable)
Arguments
Returns | Boolean | True if file is executable. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Check if a file is executable ;;********************** (defun Ex_browseLib_fileInfo_isExecutable_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isExecutable)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isExecutable_1)
Notes & Hints
No special notes.
Overview
Returns true if this object points to a file otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isFile)
Arguments
Returns | Boolean | True if fileInfo object is a file. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Check if a fileInfo object is a file ;;********************** (defun Ex_browseLib_fileInfo_isFile_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isFile)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isFile_1)
Notes & Hints
No special notes.
Overview
Returns true if this file is hidden otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isHidden)
Arguments
Returns | Boolean | True if the file is hidden. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;************************************* ;; Check if a fileInfo object is hidden ;;************************************* (defun Ex_browseLib_fileInfo_isHidden_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isHidden)) ;;-> false true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isHidden_1)
Notes & Hints
No special notes.
Overview
Returns true if the user can read the file otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isReadable)
Arguments
Returns | Boolean | True if file is readable. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;*************************************** ;; Check if a fileInfo object is readable ;;*************************************** (defun Ex_browseLib_fileInfo_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isReadable)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_1)
Notes & Hints
No special notes.
Overview
Returns true if the path name is relative otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isRelative)
Arguments
Returns | Boolean | True if the path name is relative. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;*********************************************** ;; Check if a fileInfo object's path is relative ;;*********************************************** (defun Ex_browseLib_fileInfo_isRelative_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isRelative)) ;;-> false true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isRelative_1)
Notes & Hints
No special notes.
Overview
Returns true if t his object points to a symbolic link (or to a shortcut on Windows) otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isSymLink)
Arguments
Returns | Boolean | True |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;*********************************************** ;; Check if a fileInfo object is a Smybolic link ;;*********************************************** (defun Ex_browseLib_fileInfo_isSymLink_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isSymLink)) ;;-> false true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isSymLink_1)
Notes & Hints
No special notes.
Overview
Returns true if the user can write to the file otherwise false.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.isWriteable)
Arguments
Returns | Boolean | True if file is writeable. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;**************************** ;; Check if file is writeable ;;**************************** (defun Ex_browseLib_fileInfo_isWriteable_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.isWriteable)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_isWriteable_1)
Notes & Hints
No special notes.
Overview
Returns the date and time the file was last modified.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.lastModified)
Arguments
Returns | Date | Date and time of last modification. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;*************************************************** ;; Get the date and time of last modification to file ;;*************************************************** (defun Ex_browseLib_fileInfo_lastModified_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.lastModified)) ;;-> #Jul,29,2003:08:21:38 true) ;Execute in the console: ;(Ex_browseLib_fileInfo_lastModified_1)
Notes & Hints
No special notes.
Overview
Returns the data and time when the file was last read(accessed). On platforms where this information is not available, returns the same as lastModified.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.lastRead)
Arguments
Returns | Date | Returns the date and time the file was last read. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;***************************************** ;; Get the date and time of last file read. ;;***************************************** (defun Ex_browseLib_fileInfo_lastRead_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.lastRead)) ;;-> #Jul,29,2003:08:21:38 true) ;Execute in the console: ;(Ex_browseLib_fileInfo_lastRead_1)
Notes & Hints
No special notes.
Overview
Create a new fileInfo Lambda instance.
Type: Function
Syntax examples
(new browseLib.fileInfo) (new browseLib.fileInfo dirInstance fileName) (new browseLib.fileInfo fileInfoInstance)
Arguments
fileName | String - optional | File name. |
---|---|---|
dirInstance | dir Object - optional | A dir Lambda instance previously created. |
fileInfoInstance | fileInfo Object - optional | A fileInfo Lambda instance previously created. |
Returns | fileInfo Object | A new fileInfo Lambda instance. |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;***************************** ;; Creating fileInfo instances ;;***************************** (defun Ex_browseLib_fileInfo_new_1() vars:(d f f2) ;; Create a fileInfo instance not yet associated with a file (setq f (new browseLib.fileInfo)) ;; Create a fileInfo instance for a file in the current directory (setq f (new browseLib.fileInfo "astartup.sl")) ;; Create a fileInfo instance from an exsiting fileInfo instance (setq f2 (new browseLib.fileInfo f)) ;; Create a fileInfo instance referencing a file in the instal directory (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) true) ;Execute in the console: ;(Ex_browseLib_fileInfo_new_1)
Notes & Hints
No special notes.
Overview
Returns the owner of the file. On systems where files do not have owners, or if an error occurs, #void is returned.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.owner)
Arguments
Returns | String or #void | Owner of file or #void if an error occured. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Get owner of file ;;********************** (defun Ex_browseLib_fileInfo_owner_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.owner)) ;;-> Adminstrators true) ;Execute in the console: ;(Ex_browseLib_fileInfo_owner_1)
Notes & Hints
No special notes.
Overview
Returns the id of the owner of the file. On windows and on systems where files
do not have owners this function returns -2.
See also fileInfo.owner, fileInfo.group and fileInfo.groupId.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.ownerId)
Arguments
Returns | Integer | Returns the id of the owner of the file. On windows -2 is returned. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;******************************* ;; Get the id of the file's owner ;;******************************* (defun Ex_browseLib_fileInfo_ownerId_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.ownerId)) ;;-> -2 true) ;Execute in the console: ;(Ex_browseLib_fileInfo_ownerId_1)
Notes & Hints
No special notes.
Overview
permissionSpec - permission spec symbol or vector of permission spec symbols.
Returns true if user has specified permissions on file.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.permission permissionSpec)
Arguments
permissionSpec | Vector or Symbol | A permissionSpec symbol or vector of permissionSpec symbols. Permission Specifications include: ReadOwner, WriteOwner, ExeOwner, ReadUser, WriteUser, ExeUser, ReadGroup, WriteGroup, ExeGroup, ReadOther, WriteOther, ExeOther |
---|---|---|
Returns | Boolean | True if user has specified permissions on file. |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;*************************************************** ;; Check if user has specified permissions on a file ;;*************************************************** (defun Ex_browseLib_fileInfo_permission_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.permission WriteOwner:)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_permission_1)
Notes & Hints
No special notes.
Overview
Returns the name a symlink (or shortcut on Windows) points to, or #void if the
object is a symbolic link. The name may not represent an existing file it is
only a string. fileInfo.exists returns true if the symlink points to
an existing file.
See also fileInfo.exists, fileInfo.isSymLink, fileInfo.isDir and fileInfo.isFile.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.readLink)
Arguments
Returns | String or #void | Returns the name a symlink points to. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;**************************************** ;; Get the name a symbolic link points to ;;**************************************** (defun Ex_browseLib_fileInfo_readLink_1() ;; Example not available at this time true) ;Execute in the console: ;(Ex_browseLib_fileInfo_readLink_1)
Notes & Hints
No special notes.
Overview
Refreshes the information about the file. i.e. reads in information from the file
system the next time a cached property is fetched.
See also fileInfo.setCaching.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.refresh)
Arguments
Returns | Boolean | True |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;*************************************** ;; Refresh the state of a fileInfoOBject ;;*************************************** (defun Ex_browseLib_fileInfo_refresh_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (f.refresh) true) ;Execute in the console: ;(Ex_browseLib_fileInfo_refresh_1)
Notes & Hints
No special notes.
If enable is true, enables caching of file information. If enable is false
caching is disabled.
When caching is enabled, fileInfo reads the file information from the file
system the first time it's needed, but generally not later. Caching is
enabled by default.
See also fileInfo.refresh and fileInfo.caching.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.setCaching enable)
Arguments
enable | Boolean | Pass true to enable caching, false to disable caching. |
---|---|---|
Returns | Boolean | True |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;********************** ;; Disable caching ;;********************** (defun Ex_browseLib_fileInfo_setCaching_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (f.setCaching false) ;; disable caching true) ;Execute in the console: ;(Ex_browseLib_fileInfo_setCaching_1)
Notes & Hints
No special notes.
Overview
Sets the file that the fileInfo provides information about to fileName. The fileName can be an absolute or relative path.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance. )
Arguments
fileName | String | File path. |
---|---|---|
Returns | Boolean | True |
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;******************************************** ;; Create a fileInfo instance using full path ;;******************************************** (defun Ex_browseLib_fileInfo_setFile_1() vars:(d f fileName) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq fileName (d.absFilePath "astartup.sl")) (setq f (new browseLib.fileInfo fileName)) (writeln (f.exists)) ;;-> true true) ;Execute in the console: ;(Ex_browseLib_fileInfo_setFile_1)
Notes & Hints
No special notes.
Overview
Returns the file size in bytes, or 0 if the file does not exist or the size is 0 or if the size cannot be fetched.
Type: Instance Child Lambda
Syntax examples
(fileInfoInstance.size)
Arguments
Returns | Integer | Size of file in bytes or 0 if the file does not exist. |
---|
When To Use
Use this child Lambda only on an instance of a fileInfo Lambda.
Examples
;;************************ ;; Get the size of a file ;;************************ (defun Ex_browseLib_fileInfo_size_1() vars:(d f) (setq d (new browseLib.dir _ais.installPath)); get install directory (setq f (new browseLib.fileInfo d "astartup.sl")) (writeln (f.size)) ;-> 1034 true) ;Execute in the console: ;(Ex_browseLib_fileInfo_size_1)
Notes & Hints
No special notes.