|
Class: DirectoryContents
Object
|
+--DirectoryContents
- Package:
- stx:libbasic2
- Category:
- System-Support
- Version:
- rev:
1.79
date: 2022/10/14 19:21:32
- user: stefan
- file: DirectoryContents.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
DirectoryContents provides a cached view onto a fileDirectory.
Notice:
This class is not available in other ST-systems;
Applications using it may not be portable.
copyrightCOPYRIGHT (c) 1997 by eXept Software AG
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
accessing
-
cachedDirectoryNamed: aFileOrString
-
answer the valid cached directory or nil
-
directoryNamed: aDirectoryFilenameOrString
-
returns the DirectoryContents for a directory named
aDirectoryName, aString, nil or Filename
Usage example(s):
self directoryNamed:'/tmp'.
self directoryNamed:'/home'.
self directoryNamed:'/etc'.
|
cache flushing
-
flushCache
-
flush list of remembered directory contents
Usage example(s):
-
flushCachedDirectoryFor: aDirectoryOrString
-
remove directory from cache
cleanup
-
lowSpaceCleanup
-
flush list of remembered directory contents when low on memory
Usage example(s):
constants
-
maxCachedDirectories
-
returns number of maximum cached directories
initialization
-
initialize
-
Modified (comment): / 08-02-2017 / 15:47:06 / stefan
instance creation
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
private
-
accessKeyForDirectory: aDirectoryOrString
-
computes a fast access key to retrieve the directory in the cache
-
directoryAt: aFileOrString
-
checks whether directory already exists and is valid.
If true the directory is returned otherwise nil
-
directoryAt: aFileOrString checkForValidContentsDo: checkIsValidBlock
-
answer the directoryContents stored under aFileOrString in the cache.
If the evaluation of the checkIsValidBlock returns false, the contents
will be removed from the cache and nil is returned.
queries
-
directoryNamed: aDirectoryName detect: aTwoArgBlock
-
evaluate the block, [:filename :isDirectory] on the directory
contents of a directory named aDirectoryName, until the block
returns true. If nothing detected false is returned
-
directoryNamed: aDirectoryName detect: aTwoArgBlock onOpenErrorDo: exceptionBlock
-
evaluate the block, [:filename :isDirectory] on the directory
contents of a directory named aDirectoryName, until the block
returns true. If nothing detected false is returned.
if the directory cannot be opened, the exceptionBlock is processed
with the filename.
startup & release
-
preSnapshot
-
flush list of cached directory contents before saving a snapshot
(do not save them in the image)
utilities
-
contentsItemForFileName: aFilenameOrString
-
accessing
-
accessKey
-
-
beObsolete
-
mark self as obsolete
clear contents and reset time
-
directory
-
returns the directoy name as Filename
-
modificationTime
-
get the last modification time of the directory.
Note that sometimes a root directory does not return
a valid modification time - so do not cache it.
-
timeStamp
-
get the last timeStamp (when the directory info was read) of the directory
enumerating
-
contentsAndBaseNamesDo: aThreeArgBlock
-
evaluate the block on each file; the argument to the block is the
filename, the baseName and true in case of a directory
block arguments: [:fileName :aBaseName :isDirectory|
-
contentsDo: aTwoArgBlock
-
evaluate the block on each file; the argument to the block is the
filename and true in case of a directory
block arguments: [:fileName :isDirectory|
-
directoriesAndBasenamesDo: aTwoArgBlock
-
evaluate block on each directory; a Filename and Basename.
The directories are sorted
-
directoriesDo: aOneArgBlock
-
evaluate block on each directory; a Filename. The directories are sorted
-
filesAndBasenamesDo: aTwoArgBlock
-
evaluate block on each file; a Filename and a Basename.
The files are sorted.
-
filesDo: aOneArgBlock
-
evaluate block on each file; a Filename. The files are sorted.
-
itemsDo: aBlock
-
evaluate the block on each contentsItem, which contains the fileName and type info
instance creation
-
directory: aFilename
-
DirectoryContents new directory:'.'
obsolete
-
updateContents
-
ensure that the file-info os present for every item
** obsolete - access info if required
** This is an obsolete interface - do not use it (it may vanish in future versions) **
printing
-
printOn: aStream
-
(comment from inherited method)
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
The default here is to output the receiver's class name.
BUT: this method is heavily redefined for objects which
can print prettier.
queries
-
isObsolete
-
returns true if the directory contents represented by the receiver is obsolete
(i.e. if the fileSystem's directory has been changed in the meanwhile)
-
isReadable
-
answer true if the directory is readable
no open error raised during reading the directory
-
isRootDirectory
-
-
size
-
get number of files including directories in the directory
testing
-
includesIdentical: anItem
-
-
isEmpty
-
returns true if directory is empty
-
isEmptyOrNil
-
return true if I am nil or an empty collection
-
notEmpty
-
returns true if directory is not empty
-
notEmptyOrNil
-
returns true if directory is not empty
DirectoryContentsItem
|