browseLib.dir Lambda

 

dir Overview

The dir Lambda provides access to directory structures and their contents in a platform-independent way. A dir instance is used to manipulate path names, access information regarding paths and files, and manipulate the underlying file system.

A dir instance can point to a file using either a relative or an absolute path. Absolute paths begin with the directory separator "/" (optionally preceded by a drive specification under Windows). If you always use "/" as a directory separator, the dir Lambda will translate your paths to conform to the underlying operating system. Relative file names begin with a directory name or a file name and specify a path relative to the current directory.

The "current" path refers to the application's working directory. A dir's own path is set and retrieved with setPath and path. An example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib". You can use the child Lambda isRelative to check if a dir is using a relative or an absolute file path. Call convertToAbs to convert a relative dir to an absolute one. For a simplified path use cleanDirPath. To obtain a path which has no symbolic links or redundant ".." elements use canonicalPath. The path can be set with setPath, and changed with cd and cdUp.

The dir Lambda provides several child Lambdas, for example, setCurrent to set the application's working directory and currentDirPath to retrieve the application's working directory. Access to some common paths is provided with the child Lambdas, current, home and root which return a dir instance. Use currentDirPath, homeDirPath and rootDirPath to return a path string.

The number of entries in a directory is returned by count. Obtain a string list of the names of all the files and directories in a directory with entryList. If you prefer a list of fileInfo Lambdas use entryInfoList. Use entryStructList to get a vector of entry information sturctures. These functions can apply a name filter, an attributes filter (e.g. read-only, files not directories, etc.), and a sort order. The filters and sort may be set with calls to setNameFilter, setFilter and setSorting. They may also be specified in the entryList, entryStructList and entryInfoList's arguments.

Create a new directory with mkdir, rename a directory with rename and remove an existing directory with rmdir. Remove a file with remove. You can interrogate a directory with exists, isReadable and isRoot.

To get a path with a filename use filePath, and to get a directory name use dirName, neither of these functions checks for the existence of the file or directory.

The list of root directories is provided by the drives Lambda, on Unix systems this returns a list containing one root directory, "/", on Windows the list will usually contain "C:/", and possibly "D:/", etc. It is easiest to work with "/" separators in lisp code. If you need to present a path to the user or need a path in a form suitable for a function in the underlying operating system use convertSeparators.

STATIC LambdaS/FUNCTIONS

The underlying C++ class mapped by the dir Lambda has static member functions - i.e. functions that can be called directly on the class without an instance of an object of that class. This is reflected in the dir Lambda by child Lambdas identified with a Type of "Static Child Lambda". You may call these Lambdas directly without creating an Lambda instance of dir. The other child Lambdas have a type of "Instance Child Lambda" and may only be called on an instance of the dir Lambda.

Notes

This Lambda surfaces the full functionality of the QDir object. Most of the functionality of this Lambda resides in the glueLayer and is accessed by calls to the _AISQDir function. When you create a new dir instance, a corrosponding QDir C++ object is created. Calls to child Lambdas of the dir Lambda result in corrosponding calls to the member functions of the C++ QDir object. All of these calls are made through the _AISQDir 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 entryStructList - this child Lambda returns a vector of entry information structures.

browseLib.dir Tutorial

The following code examples serve as a general tutorial on the use of the browseLib.dir Lambda. See the individual child Lambda documentation for more specific information.

		;;***********************************************
		;; Using the browseLib.dir Static child Lambdas.
		;;***********************************************
		(defun Ex_browseLib_dir_tutorial_1()
			;;Use browseLib.dir.currentDirPath to get the current application path.
			(writeln (browseLib.dir.currentDirPath)) ;;-> C:/somepath
		
			;;Use browseLib.dir.homeDirPath to get the user's home directory path.
			(writeln (browseLib.dir.homeDirPath)) ;;-> C:/somepath
			
			;;Use browseLib.dir.rootDirPath to get the system's root directory path.
			(writeln (browseLib.dir.rootDirPath)) ;;-> C:/
			
			;;Use browseLib.dir.separator to get the OS path separator character.
			(writeln (browseLib.dir.separator)) ;;-> \ or /
				
			;;Use browseLib.dir.home to get a dir Lambda instance for the user's 
			;;home path.
			(setq dirInstance (new browseLib.dir.home)) ;;-> #<Lambda 99999>
			;;Use browseLib.dir.root to get a dir Lambda instance for the root path of 
			;;the system.
			(setq dirInstance (new browseLib.dir.root)) ;;-> #<Lambda 99999>
			

		;;*************************************************
		;;Using the browseLib.dir instance child Lambdas.
		;;*************************************************
		(defun Ex_browseLib_dir_tutorial_2()
			vars:(d n InfoItemList )
			;;Create a dir instance for the current directory
			(writeln (setq d (browseLib.dir.current))) ;;-> <Lambda 9999>
			;;Use entryList to get the names of the items in the directory.
			(writeln (d.entryList)) 
			;;->#(obj| "." ".." "astartup.sl" "Dir.db" "dir.html" "dir.sl" "junk.sl" 
			
			;;Use entryList with arguments to get the names of Files: in the directory 
			;;sorted by Name:
			(writeln (d.entryList #void  Files: Name:)) 
			;;->#(obj| "Dir.db" "astartup.sl" "dir.html" "dir.sl" "junk.sl" )
		
			;;Use entryList with arguments to get the names of Files: in the directory 
			;;sorted Name: in descending order.
			(writeln (d.entryList "*.sl"  Files: #(Name: Reversed:))) 
			;;->#(obj| "junk.sl" "dir.sl" "astartup.sl" )
		
			;;Use entryList with arguments to get only the names of Files: with the .sl 
			;; extension.
			(writeln (d.entryList "*.sl" )) 
			;;->#(obj| "astartup.sl" "dir.sl" "junk.sl")
			
			;;Use entryInfoList to get infoItems for the current directory.
			(writeln (setq InfoItemList (d.entryInfoList))) 
			;; ->#(#<Lambda 9991> #<Lambda 9992> #<Lambda 9993>)
			(loop for n from 0 until (length InfoItemList) 
				(writeln (InfoItemList[n].fileName))
			)
			;;-> astartup.sl
			;;-> dir.sl
			;;-> junk.sl
			
			;;Use fileList to get a vector of directory item information structures. Each 
			;;structure contains extensive information about the directory item.
			(setq InfoItemList (d.fileList))
			(loop for n from 0 until (length InfoItemList) 
				(writeln InfoItemList[n])
			)
			;;-> #(obj| 
			;;-> #{Type: File 
			;;-> 	FileName: "astartup.sl" 
			;;-> 	Size: 218 
			;;-> 	Extension: "sl" 
			;;-> 	FilePath: "./astartup.sl" 
			;;-> 	Created: #Feb,24,2004:09:43:38 
			;;-> 	Exists: true 
			;;-> 	Group: "None" 
			;;-> 	GroupId: -2 
			;;-> 	Executable: true 
			;;-> 	Hidden: false 
			;;-> 	Readable: true 
			;;-> 	Relative: false 
			;;-> 	SymLink: false 
			;;-> 	Writable: true 
			;;-> 	Modified: #Feb,24,2004:09:48:27 
			;;-> 	Read: #Mar,24,2004:09:47:17 
			;;-> 	Owner: "Administrators" 
			;;-> 	OwnerId: -2 Link: ""}
			;;-> #{Type: File FileName: "dir.sl" ...
			;;-> #{Type: File FileName: "junk.sl" ...
			;;-> )	
			true);
				

dir.absFilePath

Overview

Returns the absolute path name of a file in the directory. Does not check if the file actually exists in the directory. Redundant multiple separators or "." and ".." directories in fileName will not be removed.
See also filePath.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.absFilePath "somefile.sl")
			

Arguments


fileName String Filename or absolute path
accepthAbsPath Boolean - Optional
Default=true
If acceptAbsPath is TRUE a fileName starting with a separator "/" will be returned without change. If acceptAbsPath is FALSE an absolute path will be prepended to the fileName and the resultant string returned.
Returns String Returns the absolute path string of a file in the directory.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;***************************************************************
		;;Getting the full path for a new file in the current directory.
		;****************************************************************
		(defun Ex_browseLib_dir_absFilePath_1()
			vars:(d)
			(setq d (browseLib.dir.current)) ;; get current directory
			(writeln (d.absFilePath "myfile.sl")) ;; -> C:/myapplication/myfile.sl
			true)
			

Notes & Hints

The file specified by the fileName argument does not have to exist.

dir.absPath

Overview

Returns the absolute path (a path that starts with "/" or with a drive specification), which may contain symbolic links, but never contains redundant ".", ".." or multiple separators.
See also setPath, canonicalPath, exists, cleanDirPath, dirName, and absFilePath.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.absPath)
			

Arguments


Returns String Returns the absolute path string.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;****************************************
		;;Using absPath on the current directory.
		;;****************************************
		(defun Ex_browseLib_dir_absPath_1()
			vars:(d)
			(setq d (browseLib.dir.current)) ;; get the current directory
			(writeln (d.absPath)) ;; -> C:/myapplication
			true)
			

Notes & Hints

No special notes.

dir.canonicalPath

Overview

Returns the canonical path, i.e. a path without symbolic links or redundant "." or ".." elements. On systems that do not have symbolic links this function will always return the same string that absPath returns. If the canonical path does not exist (normally due to dangling symbolic links) canonicalPath returns #void.

Type: Instance Child Lambda

Syntax examples

				(dirInstance.canonicalPath)
				

Arguments


Returns String or #Void Canonical Path

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

			;;**********************************************
			;;Using canonicalPath on the current directory.
			;;**********************************************
			(defun Ex_browseLib_dir_canonicalPath_1()
				vars:(d)
				(setq d (browseLib.dir.current)) ;; get the current directory
				(writeln (d.canonicalPath)) ;; -> C:/myapplication
				true)
				

Notes & Hints

No special notes.

dir.cd

Overview

Changes the dir's directory to dirName. If acceptAbsPath is TRUE a path starting with separator "/" will cause the function to change to the absolute directory. If acceptAbsPath is FALSE any number of separators at the beginning of dirName will be removed and the function will descend into dirName. Returns TRUE if the new directory exists and is readable otherwise returns FALSE. Note that the logical cd operation is not performed if the new directory does not exist. Calling (dirInstance.cd ".." ) is equivalent to calling (dirInstance.cdUp). See also; cdUp, isReadable, exists, and path.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.cd "somedir")
			

Arguments


dirName String Name of target directory.
accepthAbsPath Boolean - Optional
Default=true
If acceptAbsPath is TRUE a path starting with separator "/" will cause the function to change to the absolute directory. If acceptAbsPath is FALSE any number of separators at the beginning of dirName will be removed and the function will descend into dirName.
Returns Boolean True if sucessful or False otherwise.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**************************************
		;;Using dir.cd to navigate directories.
		;;**************************************
		(defun Ex_browseLib_dir_cd_1()
			vars:(d d2)
			(setq d (browseLib.dir.current)) ;; get the current directory
			(writeln (d.absPath)) ;; -> C:/myapplication
			(d.cd "Source") ;; change directory 
			(writeln (d.absPath)) ;;-> C:/myapplication/Source
			
			;; Show that using cd did not change the current application directory
			(setq d2 (browseLib.dir.current)) ;; get the current directory
			(writeln (d2.absPath)) ;;-> C:/myapplication
			true)
			

Notes & Hints

Remember that the cd Lambda changes the directory assoicated with the instance of d on which it is called. It does not change your current applciation directory.

dir.cdUp

Overview

Changes directory by moving one directory up from the dir's current directory. Returns TRUE if the new directory exists and is readable otherwise returns FALSE. Note that the logical cdUp operation is not performed if the new directory does not exist.
See also cd, isReadable, exists, and path.

Type: Instance Child Lambda

Syntax examples

(dirInstance.cdUp)
			

Arguments


Returns Boolean Returns TRUE if the new directory exists and is readable otherwise returns FALSE.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;************************************
		;;Using cdUp to navigate directories.
		;;************************************
		(defun Ex_browseLib_dir_cdUp_1()
			vars:(d d2)
			(setq d (browseLib.dir.current)) ;; get the current directory
			(writeln (d.absPath)) ;; -> C:/myapplication
			(d.cdUp) ;; Change directory to the parent directory
			(writeln (d.absPath)) ;;-> C:/
			
			;; Show that we did not change the current application directory
			(setq d2 (browseLib.dir.current)) ;; get the current directory
			(writeln (d2.absPath)) ;;-> C:/myapplication
			true)
			

Notes & Hints

Remember that the cdUp Lambda changes the directory assoicated with the instance of d on which it is called. It does not change your current applciation directory.

dir.cleanDirPath

Overview

Removes all multiple directory separators "/" and resolves any "."s or ".."s found in the path, filePath. Symbolic links are kept. This function does not return the canonical path, but rather the simplest version of the input. For example, "./local" becomes "local", "local/../bin" becomes "bin" and "/local/usr/../bin" becomes "/local/bin".
See also absPath and canonicalPath.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.cleanDirPath somepath)
			

Arguments


filePath String File path.
Returns String Simplest version of the input path.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda. Use this function to simplify path's returned from other calls or received as input from users.

Examples

		;;************************************************************
		;;Use this child Lambda to reduce a path to its simplest form.
		;;************************************************************
		(defun Ex_browseLib_dir_cleanDirPath_1()
			(writeln (browseLib.dir.cleanDirPath 
				"C:///ais/libraries/../libraries//browseLib"))
			;;-> C:/ais/libraries/browseLib
			true)
			

Notes & Hints

No special notes.

dir.currentDirPath

Overview

Returns the absolute path of the application's current directory. See also current

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.currentDirPath)
			

Arguments


Returns Stirng The abosolute path of the application's current directory.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		(defun Ex_browseLib_dir_currentDirPath_1()
			(writeln (browseLib.dir.currentDirPath)) ;;-> C:/myapplication
			true)
			

Notes & Hints

No special notes.

dir.convetToAbs

Overview

Converts the directory path to an absolute path. If it is already absolute nothing is done. See also isRelative.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.convertToAbs)
			

Arguments


Returns Boolean Returns TRUE.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*****************************************************************************
		;;Use covertToAbs to convert a dir instance from a relative to a absolute path.
		;;*****************************************************************************
		(defun Ex_browseLib_dir_convertToAbsPath_1()
			vars:(d)
			;; get current directory using a relative path
			(setq d (new browseLib.dir ".")) 
			(writeln (d.path)) ;; -> .
			(d.convertToAbs)
			(writeln (d.path)) ;;-> C:/myapplciation
			true)
			

Notes & Hints

No special notes.

dir.convertSeparators

Overview

Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system. On Windows, convertSeparators("c:/winnt/system32") returns "c:\winnt\system32". The returned string may be the same as the argument on some operating systems, for example on Unix.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.converSeparators somePath)
			

Arguments


pathName String A path
Returns String Returns pathName with the '/' separators converted to separators that are appropriate for the underlying operating system.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;***********************************************************************
		;;Use this child Lambda to convert path separators for the underlying OS.
		;;***********************************************************************
		(defun Ex_browseLib_dir_convertSeparators_1()
			;; On Windows
			(browseLib.dir.converSeparators "c:/winnt") ;;->c:\winnt
			true)
			

Notes & Hints

You don't normally have to worry about converting separators as AIS performs this function automatically in most calls.

dir.count

Overview

Returns the total number of directories and files that were found.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.count)
			

Arguments


Returns Integer Number of items found in directory.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		(defun Ex_browseLib_dir_count_1()
			vars:(d)
			(setq d (browseLib.dir.current)) ;; get the current directory
			(writeln (d.count)) ;; -> 3
			true)
			

Notes & Hints

No special notes.

dir.current

Overview

Returns the application's current directory.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.current)
			

Arguments


Returns Object Returns a dir instance associated with the application's current directory.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		(defun Ex_browseLib_dir_current_1()
			vars:(d)
			(setq d (browseLib.dir.current)) ;; get the current directory
			(writeln (d.absPath)) ;;-> C:/myapplication
			true)
			

Notes & Hints

No special notes.

dir.dirName

Overview

Returns the name of the directory, this is not the same as the path, e.g. a directory with the name "mail", might have the path "/var/spool/mail". If the directory has no name (e.g. it is the root directory) #void is returned. No check is made to ensure that a directory with this name actually exists. See also path, absPath, absFilePath and exists.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.dirName)
			

Arguments


Returns String or Void Returns the name of the directory or #void if at root directory.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*****************************
		;;Get the name of a directory
		;;*****************************
		(defun Ex_browseLib_dir_dirName_1()
			vars:(d)
			(setq d (new browseLib.dir "C:/winnt/System32"))
			(writeln (d.dirName)) ;;-> System32
			true)
			

Notes & Hints

No special notes.

dir.drives

Overview

Returns a vector of the root directories on this system. On Windows this returns a number of fileInfo objects containing "C:/", "D:/" etc. On other operating systems, it returns just one fileInfo object for the root directory (e.g. "/"). The vector returned is a copy of the information maintained internally by the dir Lambda.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.drives)
			

Arguments


Returns Object Vector Vector of fileInfo objects.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;****************************************
		;;Get a list of the drives on the system.
		;;****************************************
		(dir Ex_browseLib_dir_drives_1()
			vars:(i drives)
			(setq drives (browseLib.dir.drives))
			(loop for i from 0 until (length drives) do
				(writeln drives[i].path)
			)
			;;-> A:/
			;;-> C:/
			;;-> D:/
			true)
			

Notes & Hints

No special notes.

dir.entryInfoList

Overview

Returns a vector of fileInfo objects for all the files and directories in the directory, ordered in accordance with setSorting and filtered in accordance with setFilter and setNameFilter. The vector returned is a COPY of the information maintained internally by the dir Lambda. The filter and sorting specifications can be overridden using the nameFilter, filterSpec and sortSpec arguments. Returns #void if the directory is unreadable or does not exist or an argument error was encountered.
See also entryList, setNameFilter, setSorting, and setFilter.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.entryInfoList)
			(dirInstance.entryInfoList nameFilter)
			(dirInstance.entryInfoList nameFilter filterSpec)
			(dirInstance.entryInfoList nameFilter filterSpec sortSpec)
			

Arguments


NameFilter String Regular Expression Specification for match against filename
FilterSpec Symbol or vector of Symbols Filter spec symbols include: Dirs, Files, Drives, NoSymLink, All, TypeMask, Readable, Writeable, Executable, RWEMask, Modified, Hidden, System, AccessMask, DefaultFilter
SortSpec Symbol or vector of Symbols Sort spec symbols include: Name, Time, Size, Unsorted, SortByMask, DirsFirst, Reversed, IgnoreCase, DefaultSort
Returns retType retDesc

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;********************************************************************************
		;;Use entryInfoList to examine detailed file information in the current directory.
		;;********************************************************************************
		(defun Ex_browseLib_dir_entryInfoList_1()
			vars:(d n list)
			(setq d (browseLib.dir.current)) ;; get a dir instance for the current directory
			(setq list (d.entryInfoList))
			(loop for n from 0 until (length list) do
				(writeln (list[n].fileName))
			);n
			true)
			

Notes & Hints

No special notes.

dir.entryList

Overview

Returns a vector of the names of all the files and directories in the directory, ordered in accordance with setSorting and filtered in accordance with setFilter and setNameFilter.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.entryList)
			(dirInstance.entryList nameFilter)
			(dirInstance.entryList nameFilter filterSpec)
			(dirInstance.entryList nameFilter filterSpec sortSpec)
			

Arguments


NameFilter String Regular Expression Specification for match against filename
FilterSpec Symbol or vector of Symbols Filter spec symbols include: Dirs, Files, Drives, NoSymLink, All, TypeMask, Readable, Writeable, Executable, RWEMask, Modified, Hidden, System, AccessMask, DefaultFilter
SortSpec Symbol or vector of Symbols Sort spec symbols include: Name, Time, Size, Unsorted, SortByMask, DirsFirst, Reversed, IgnoreCase, DefaultSort
Returns retType retDesc

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;********************************************************************************
		;;Use entryList to get the names of items in the current directory.
		;;********************************************************************************
		(defun Ex_browseLib_dir_entryList_1()
			vars:(d n list)
			(setq d (browseLib.dir.current)) ;; get a dir instance for the current directory
			(setq list (d.entryList))
			(loop for n from 0 until (length list) do
				(writeln list[n])
			);n
			true)
			

Notes & Hints

No special notes.

dir.entryStructList

Overview

Returns a vector of directory entry information structures for all the files and directories in the directory, ordered in accordance with setSorting and filtered in accordance with setFilter and setNameFilter. The filter and sorting specifications can be overridden using the filterSpec and sortSpec arguments. Returns an empty vector if the directory is unreadable or does not exist.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.entryStructList)
			(dirInstance.entryStructList nameFilter)
			(dirInstance.entryStructList nameFilter filterSpec)
			(dirInstance.entryStructList nameFilter filterSpec sortSpec)
			

Arguments


NameFilter String Regular Expression Specification for match against filename
FilterSpec Symbol or vector of Symbols Filter spec symbols include: Dirs, Files, Drives, NoSymLink, All, TypeMask, Readable, Writeable, Executable, RWEMask, Modified, Hidden, System, AccessMask, DefaultFilter
SortSpec Symbol or vector of Symbols Sort spec symbols include: Name, Time, Size, Unsorted, SortByMask, DirsFirst, Reversed, IgnoreCase, DefaultSort
Returns retType retDesc

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;************************************************
		;; Get information for the entries in a directory
		;;************************************************
		(defun Ex_browseLib_dir_entryStructuList_1()
			vars:(d list n)
			(setq d (browseLib.dir.current)) ;; get a dir instance for the current directory
			(setq list (d.entryStructList))
			(loop for n from 0 until (length list) (writeln list[n]))	
			true)
			

Notes & Hints

NOTE: This child Lambda has no corrosponding QDir counterpart. We are taking the results of an entryInfoList call and creating the file information structures.

dir.exists

Overview

Checks for the existence of the file name or existence of directory if no argument is passed.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.exists)
			

Arguments


fileName String Name of file
Returns Boolean True if file or directory exists or False otherwise.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**************************************
		;; Check if directories and files exist.
		;;**************************************
		(defun Ex_browseLib_dir_exists_1()
			vars:(d)
			(setq d (browseLib.dir.current)) ;; get a dir instance for the current directory
			(writeln (d.exists)) ;;-> true
			(writeln (d.exists "somefile.yada")) ;;-> false
			true)
			

Notes & Hints

No special notes.

dir.filePath

Overview

Returns the path name of a file in the directory. Does not check if the file actually exists in the directory. If the dir is relative the returned path name will also be relative. Redundant multiple separators or "." and ".." directories in fileName will not be removed (see cleanDirPath).

Type: Instance Child Lambda

Syntax examples

			(dirInstance.filePath)
			

Arguments


fileName String
accepthAbsPath Boolean - Optional
Default=true
If acceptAbsPath is TRUE a fileName starting with a separator "/" will be returned without change. If acceptAbsPath is FALSE an absolute path will be prepended to the fileName and the resultant string returned.
Returns retType retDesc

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**********************
		;; Get the filepath of a file in a directory.
		;;**********************
		(defun Ex_browseLib_dir_filePath_1()
			vars:(d)
			(setq d (new browseLib.dir "C:/mydir")) ;; get the current directory
			(writeln (d.filePath "anewfile.txt" true)) ;-> C:/mydir/anewfile.txt
			true)
			

Notes & Hints

No special notes.

dir.filter

Overview

Returns the vector of filter specificaiton symbols that were set by setFilter. See setFilter for a list of allowed filter specifications.
Filter Specification Symbols Include:

Type: Instance Child Lambda

Syntax examples

			(dirInstance.filter)
			

Arguments


Returns Vector A vector of filter specification symbols.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**********************
		;; Example_Description
		;;**********************
		(defun Ex_browseLib_dir_filter_1()
			vars:(d)
			;Get current filter specifications
			(setq d (new browseLib.dir "C:/mydir")) ;; get a dir instance for the current directory
			(d.setFilter #(Files: Writeable:)) ; list only writeable files in directory
			(writeln (d.filter)) ;;-> #(Files: Writeable:)
			true)
			

Notes & Hints

No special notes.

dir.home

Overview

Returns the home directory. Under Windows the HOME environment variable is used. If this does not exist the USERPROFILE environment variable is used. If that does not exist the path is formed by concatenating the HOMEDRIVE and HOMEPATH environment variables. If they don't exist the rootDirPath is used (this uses the SystemDrive environment variable). If none of these exist "C:\" is used. Under non-Windows operating systems the HOME environment variable is used if it exists, otherwise rootDirPath is used.
See also homeDirPath.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.home)
			

Arguments


Returns dir Object Returns an Lambda instance of the dir Lambda.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;*******************************************************************
		;; Get a dir Lambda instance associated with the user's home directory
		;;*******************************************************************
		(defun Ex_dir_home_1()
			vars:(d)
			(setq d (browseLib.dir.home))
			(writlen (d.path))
			true)
			

Notes & Hints

No special notes.

dir.homeDirPath

Overview

Returns the absolute path of the user's home directory.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.homeDirPath)
			

Arguments


Returns String User's home directory path.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;********************************
		;; Get user's home directory path
		;;********************************
		(defun Ex_browseLib_dir_homeDirPath_1()
			(writeln (browseLib.dir.homeDirPath)) ;;-> C:/myhomedirectory
			true)
			

Notes & Hints

No special notes.

dir.isReadable

Overview

Returns true if the directory is readable.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.isReadable)
			

Arguments


Returns Boolean True if directory is readable - False otherwise.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*********************************
		;; Check if a directory is readable
		;;*********************************
		(defun Ex_browseLib_dir_isReadable_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(writeln (d.isReadable)) ;;-> true
			true)
			

Notes & Hints

No special notes.

dir.isRelative

Overview

Returns TRUE if the directory path is relative to the current directory and returns FALSE if the path is absolute (e.g. under UNIX a path is relative if it does not start with a "/".
See also convertToAbs.

Type: Instance Child Lambda

Instance Child Lambda

			(dirInstance.isRelative)
			

Arguments


Returns Boolean True if directory is relative.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**********************
		;; Check if the current directory is relative
		;;**********************
		(defun Ex_browseLib_dir_isRelative_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(writeln (d.isRelative)) ;;-> false
			true)
			

Notes & Hints

No special notes.

dir.isRelativePath

Overview

Returns TRUE if path is relative returns FALSE if it is absolute.
See also isRelative.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.isRelatativePath pathName)
			

Arguments


pathName String Path
Returns Boolean True if path is relative - False otherwise.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;********************************************
		;; Determine if a path is relative or absolute
		;;********************************************
		(defun Ex_dir_isRelative_1()
			(writeln (browseLib.dir.isRelativePath "C:/somedir")) ;-> false
			(writeln (browseLib.dir.isRelativePath "./somedir")) ;-> true
			true)
			

Notes & Hints

No special notes.

dir.isRoot

Overview

Returns true if the dir instance is associated with the root directory.
See also root and rootDirPath.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.isRoot)
			

Arguments


Returns Boolean True if dir instance is associated with root directory - otherwise False.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;******************************************************
		;; Check if the current directory is the root directory
		;;******************************************************
		(defun Ex_browseLib_dir_isRoot_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(writeln (d.isRoot)) ;;-> false
			
			;Check if current directory is a symbolic link pointing to root directory
			(setq d (new browseLib.dir (d.canonicalPath)))
			(writeln (d.isRoot)) ;-> false
		
			true)
			

Notes & Hints

Note: If the directory is a symbolic link to the root directory this function returns False. If you want to test for this use canonicalPath as shown in the example above.

dir.match

Overview

Returns TRUE if the fileName matches the wildcard (glob) pattern filter otherwise returns FALSE. The filter may contain multiple patterns separated by spaces or semicolons.
See QRegExp wildcard matching and QRegExp::match().

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.match filter fileName)
			

Arguments


filter String Wildcard pattern
fileName String File name
Returns Boolean Returns True if the fileName matches the wildcard pattern - otherwise False.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;**********************
		;; Example_Description
		;;**********************
		(defun Ex_browseLib_dir_match_1()
			(writeln (browseLib.dir.match "*.sl" "filename.sl")) ;;-> true
			true)
			

Notes & Hints

No special notes.

dir.matchAllDirs

Overview

Returns the value set by setMatchAllDirs.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.matchAllDirs)
			

Arguments


Returns Boolean Value set with setMatchAllDirs.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;************************************************
		;; Change value of matchAllDirs in a dir instance
		;;************************************************
		(defun Ex_browseLib_dir_matchAllDirs_1()
			vars:(d)
			(setq d (new browseLib.dir "C:/AIS" ))
			(d.setNameFilter "*.sl")
			(d.setMatchAllDirs false)
			(writeln (d.entryList)) ;;-> #(obj| "astartup.sl") 
			(d.setMatchAllDirs true)
			(writeln (d.entryList)) 
			;;-> #(obj| "." ".." "astartup.sl" "docs" "Libraries" "logs" "usr" "wwwroot" )
			true)
			

Notes & Hints

No special notes.

dir.mkdir

Overview

Creates a directory.
See also rmdir.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.mkdir dirName)
			(dirInstance.mkdir dirName true)
			

Arguments


dirName String A relative or absolute path directory name.
acceptAbsPath Boolean If acceptAbsPath is TRUE a path starting with a separator ('/') will create the absolute directory. If acceptAbsPath is FALSE any number of separators at the beginning of dirName will be removed.
Returns Boolean Returns True if successful - otherwise returns False

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*******************************************************
		;; Create and remove a directory under current directory
		;;*******************************************************
		(defun Ex_browseLib_dir_mkdir_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(if (d.exists "JUNKDIR") (d.rmdir "JUNKDIR"))
			(d.mkdir "JUNKDIR")
			(writeln (d.exists "JUNKDIR"))
			(d.rmdir "JUNKDIR")
			true)
			

Notes & Hints

No special notes.

dir.nameFilter

Overview

Returns value set with setNameFilter.
See setNameFilter.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.nameFilter)
			

Arguments


Returns String Value set with setNameFilter.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**************************************************
		;; Get the current nameFilter value of dir instance
		;;**************************************************
		(defun Ex_browseLib_dir_nameFilter_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(d.setNameFilter "*.sl")
			(writeln (d.nameFilter)) ;;-> "*.sl"
			true)
			

Notes & Hints

No special notes.

dir.new

Overview

Construct a new dir Lambda instance with path dirPath, that filters its entries by name using nameFilter and by attributes using filterSpec. It also sorts the names using sortSpec.
The default nameFilter is an empty string, which excludes nothing.
The default filterSpec is All, which also means exclude nothing.
The default sortSpec is #(Name: IgnoreCase:), i.e. sort by name case-insensitively.

Type: Function

Syntax examples

			(math.cursorToMatrix cursor fieldNames)
			(browseLib.dir.current)
			(new browseLib.dir dirPath)
			(new browseLib.dir dirPath nameFilter)
			(new browseLib.dir dirPath nameFilter sortSpec)
			(new browseLib.dir dirPath nameFilter sortSpec filterSpec)
			

Arguments


dirPath String - optional Directory path.
nameFilter String - optional Wildcard specification.
FilterSpec Symbol or vector of Symbols Filter spec symbols include: Dirs, Files, Drives, NoSymLink, All, TypeMask, Readable, Writeable, Executable, RWEMask, Modified, Hidden, System, AccessMask, DefaultFilter
SortSpec Symbol or vector of Symbols Sort spec symbols include: Name, Time, Size, Unsorted, SortByMask, DirsFirst, Reversed, IgnoreCase, DefaultSort
Returns dir Object dir Lambda instance.

When To Use

Use the new function to create dir instances.

Examples

		;;**********************************************
		;; Create a dir instance using the new function
		;;**********************************************
		(defun Ex_browseLib_dir_new_1()
			vars:(d)
			(setq d (new browseLib.dir "C:")) ;; get c drive root directory
			;; get directory of sl files in current application directory
			(setq d (new browseLib.dir #void "*.sl")) 
			;; get all files in current application directory sorted by date time stamp
			(setq d (new browseLib.dir #void #void Time:)) 
			true)
			

Notes & Hints

No special notes.

dir.path

Overview

Returns the path, this may contain symbolic links, but never contains redundant ".", ".." or multiple separators. The returned path can be either absolute or relative, see setPath.
See also setPath, absPath, exists, cleanDirPath, dirName, absFilePath, and convertSeparators.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.path)
			

Arguments


Returns String Path assoicated with dir instance.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*************************
		;; Get path of a directory
		;;*************************
		(defun Ex_browseLib_dir_path_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(writeln (d.path)) ;;-> C:/AIS
			true)
			

Notes & Hints

No special notes.

dir.refresh

Overview

Refreshes the directory information.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.refresh)
			

Arguments


Returns Boolean Returns True.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;***************************************************************
		;; Use refresh to force an update of the dir instance information
		;;***************************************************************
		(defun Ex_browseLib_dir_refresh_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			;.. code that modifies the contents of the directory
			(d.refresh) ;;-> true
			true)
			

Notes & Hints

No special notes.

dir.remove

Overview

Removes a file from the directory.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.remove fileName)
			(dirInstance.remove fileName false)
			

Arguments


fileName String File path
accepthAbsPath Boolean - Optional
Default=true
If acceptAbsPath is TRUE a path starting with separator "/" will remove the file with the absolute path. If acceptAbsPath is FALSE any number of separators at the beginning of fileName will be removed and the resultant file name will be removed.
Returns Boolean Returns TRUE if the file is removed successfully otherwise returns FALSE.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;********************************
		;; Removed a file from a directory
		;;********************************
		(defun Ex_browseLib_dir_remove_1()
			vars:(d filePath fileID)
			(setq d (browseLib.dir.current))
			(setq filePath (d.absFilePath "_afiletodelete.txt"))
			(setq fileID (fileOpen filePath 1 0)) ; open a new text file
			(fileClose fileID 1) ; close file
			(d.refresh) ; refresh directory to show newly created file
			(writeln (d.entryList)) ;;-> #(obj| _afiletodelete.txt ...)
			(writeln (d.remove filePath))
			(d.refresh)
			(writeln (d.entryList))
			true)
			

Notes & Hints

No special notes.

dir.rename

Overview

Renames a file or directory.
On most file systems, rename fails only if oldName does not exist or if newName and oldName are not on the same partition. On Windows, rename will fail if newName already exists. However, there are also other reasons why rename can fail. For example, on at least one file system rename fails if newName points to an open file.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.rename oldName newName)
			(dirInstance.rename oldName newName false)
			

Arguments


oldName String file path
newName String file path
accepthAbsPath Boolean - optional default=True If acceptAbsPaths is TRUE a path starting with a separator ('/') will rename the file with the absolute path if acceptAbsPaths is FALSE any number of separators at the beginning of the names will be removed.
Returns Boolean Returns TRUE if successful otherwise returns FALSE.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**********************
		;; Rename a file
		;;**********************
		(defun Ex_browseLib_dir_rename_1()
			vars:(d filePath newFilePath fileID)
			(setq d (browseLib.dir.current))
			;create a new file
			(setq filePath (d.absFilePath "_afiletorename.txt"))
			(setq fileID (fileOpen filePath 1 0)) ; open a new text file
			(fileClose fileID 1) ; close file
			(d.refresh) ; refresh directory to show newly created file
			(writeln (d.entryList)) ;;-> #(obj| _afiletodelete.txt ...)
			(setq newFilePath (d.absFilePath "_afilerenamed.txt"))
			(writeln (d.rename filePath newFilePath))
			(d.refresh)
			(writeln (d.entryList))
			;Clean up directory by deleting our work file
			(d.remove newFilePath)
			true)
			

Notes & Hints

No special notes.

dir.rmdir

Overview

Removes a directory. The directory must be empty for rmdir() to succeed.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.rmdir dirPath)
			(dirInstance.rmdir dirPath false)
			

Arguments


dirName String Directory path.
accepthAbsPath Boolean - optional default=True If acceptAbsPath is TRUE a path starting with a separator ('/') will remove the absolute directory if acceptAbsPath is FALSE any number of separators at the beginning of dirName will be removed.
Returns Boolean Returns TRUE if successful otherwise returns FALSE.

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;**********************
		;; Remove a directory
		;;**********************
		(defun Ex_browseLib_dir_rmdir_1()
			vars:(d newDir dirPath)
			(setq d (browseLib.dir.current))
			(if (d.exists "JUNKDIR") (d.rmdir "JUNKDIR"))
			(d.mkdir "JUNKDIR")
			(writeln (d.exists "JUNKDIR"))
			(d.rmdir "JUNKDIR")
			true)
			

Notes & Hints

No special notes.

dir.root

Overview

Returns the root directory.
See also rootDirPath and drives.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.root)
			

Arguments


Returns dir Object Returns a dir Lambda instance associated with the root directory of system.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;*************************************
		;; Get the root directory of the system
		;;*************************************
		(defun Ex_browseLib_dir_root_1()
			vars:(d)
			(setq d (browseLib.dir.root))
			(writeln (d.entryList)) ;;-> ...files in the root directory...
			true)
			

Notes & Hints

No special notes.

dir.rootDirPath

Overview

Returns the absolute path for the root directory.
For UNIX operating systems this returns "/". For Windows file systems this normally returns "c:/".
See also root and drives.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.rootDirPath)
			

Arguments


Returns String Path of root directory in system.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;**************************************************
		;; Get the path to the root directory of the system.
		;;**************************************************
		(defun Ex_browseLib_dir_rootDirPath_1()
			(writeln (browseLib.dir.rootDirPath))
			true)
			

Notes & Hints

No special notes.

dir.separator

Overview

Returns the native directory separator "/" under UNIX (including Mac OS X) and "\" under Windows. You do not need to use this function to build file paths. If you always use "/", AIS will translate your paths to conform to the underlying operating system.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.separator)
			

Arguments


Returns Text Character Separator used on the underying operating system.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;***************************************************************
		;; Get the directory separator used on the host operating system.
		;;***************************************************************
		(defun Ex_browseLib_dir_separator_1()
			(writeln (browseLib.dir.separator))
			true)
			

Notes & Hints

No special notes.

dir.setCurrent

Overview

Sets the application's current working directory.

Type: Static Child Lambda

Syntax examples

			(browseLib.dir.setCurrent path)
			

Arguments


path String Path
Returns Boolean Returns TRUE if the directory was successfully changed otherwise returns FALSE.

When To Use

Call this child Lambda on the browseLib.dir Lambda or an instance of the dir Lambda.

Examples

		;;******************************************
		;; Change the applications current directory
		;;******************************************
		(defun Ex_browseLib_dir_setCurrent_1()
			vars:(d dirPath)
			(setq d (browseLib.dir.current)) ; get the applications current directory
			(setq dirPath (d.absPath))
			(if (not (d.exists "NEWAPPDIR")) 
				(d.mkdir "NEWAPPDIR"))
			(d.setCurrent "NEWAPPDIR")
			(writeln (d.current))
			(d.setCurrent dirPath)
			(d.rmdir "NEWAPPDIR")
			true)
			

Notes & Hints

No special notes.

dir.setFilter

Overview

Sets the filter used by entryList and entryInfoList to filterSpec. The filter is used to specify the kind of files that should be returned by entryList and entryInfoList.
Filter Specification Symbols Include:

Type: Instance Child Lambda

Syntax examples

			(dirInstance.setFilter #(Dirs: Files: Modified:))
			(dirInstance.setFilter Dirs:)
			

Arguments


filterSpec Vector or Symbol Vector of filter specifications or single filterSpec symbol
Returns Boolean True

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;****************************************************
		;; Change the filter specifications on a dir instance
		;;****************************************************
		(defun Ex_browseLib_dir_setFilter_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(d.setFilter Dirs:)
			(writeln (d.entryList)) ;;-> list of directories under current application directory
			true)
			

Notes & Hints

No special notes.

dir.setMatchAllDirs

Overview

Changes the effect of nameFilter. If enable is TRUE then all directories are included (e.g. in entryList), and the nameFilter is only applied to the files. If enable is FALSE then the nameFilter is applied to both directories and files.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.setMatchAllDirs enable)
			

Arguments


enable Boolean If enable is TRUE then all directories are included (e.g. in entryList), and the nameFilter is only applied to the files. If enable is FALSE then the nameFilter is applied to both directories and files.
Returns Boolean True

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*************************************************
		;; Use name filter on directories as well as files.
		;;*************************************************
		(defun Ex_browseLib_dir_setMatchAllDirs_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(d.setMatchAllDirs true)
			(d.setNameFilter "_*") ; match entry items that begin with "_"
			(writeln (d.entryList)) ;;-> ...items that begin with "_"
			true)
			

Notes & Hints

No special notes.

dir.setNameFilter

Overview

Sets the name filter used by entryList, entryStructList and entryInfoList to nameFilter.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.setNameFilter nameFilter)
			

Arguments


nameFilter String One or more Wildcard match patterns separated by semicolons.
Returns Boolean True

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*********************************************************
		;; Using name filter to filter contents of directory lists
		;;*********************************************************
		(defun Ex_browseLib_dir_setNameFilter_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(d.setNameFilter "*.sl")
			(writeln (d.entryList)) ;;--> Show only files ending with .sl
			true)
			

Notes & Hints

No special notes.

dir.setPath

Overview

Sets the path of the directory to path. The path is cleaned of redundant ".", ".." and of multiple separators. No check is made to ensure that a directory with this path exists.
The path can be either absolute or relative. Absolute paths begin with the directory separator "/" (optionally preceded by a drive specification under Windows). Relative file names begin with a directory name or a file name and specify a path relative to the current directory. An example of an absolute path is the string "/tmp/quartz", a relative path might look like "src/fatlib".

Type: Instance Child Lambda

Syntax examples

			(dirInstance.setPath path)
			

Arguments


path String Directory path.
Returns Boolean True

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*******************************************
		;; Recurse a directory tree using dir.setPath
		;; This example uses a single instance of a dir
		;; Lambda to traverse all directories off the
		;; root path of the system.
		;;*******************************************
		(defun Ex_browseLib_dir_setPath_1()
			pvars:(recurseDir )
			(defun recurseDir(dirInstance indent)
				vars:(i list fill)
				(setq fill (rept " " indent))
				(setq indent (+ indent 1))
				(setq list (dirInstance.entryList))
				(loop for i from 0 until (length list) do
					(if (not (or (= "." list[i]) (= ".." list[i]))) (begin
						(writeln fill list[i])
						(dirInstance.setPath (dirInstance.absFilePath list[i]))
						(dirInstance.refresh)
						(recurseDir dirInstance indent)
						(dirInstance.cdUp)
						))
					);i
				true);end of recurseDir
			
			;*** Main Logic ****		
			vars:(d list dirInstance)
			(setq dirInstance (browseLib.dir.root))
			(dirInstance.setFilter Dirs:) ; return only directory entries when using entryList
			(writeln (dirInstance.absPath))
			(recurseDir dirInstance 1)
			true)
			

Notes & Hints

No special notes.

dir.setSorting

Overview

Sets the sort order used by entryList, entryStructList and entryInfoList. The sortSpec is a vector of sort specification symbols or a single sort specification symbol.
See also sorting and SortSpec.

Type: Instance Child Lambda

Syntax examples

			(dirInstance.setSorting sortSpec)
			

Arguments


sortSpec Vector or Symbol A vector of sort spec symbols or a single sort spec symbol.
Returns Boolean True

When To Use

Use this child Lambda only on an instance of a dir Lambda.

Examples

		;;*******************************
		;; Sorting a directory entry list 
		;;*******************************
		(defun Ex_browseLib_dir_setSorting_1()
			vars:(d)
			(setq d (browseLib.dir.current))
			(d.setSorting Size:)
			(writeln (d.entryList)) ;;-> ..items listed in order by size ascending..
			(d.setSorting #(Size: Reversed:)) 
			;;-> ..items listed in order by size descending..
			true)
			

Notes & Hints

No special notes.