|
Class: DirectoryContents
Object
|
+--DirectoryContents
- Package:
- stx:libbasic2
- Category:
- System-Support
- Version:
- rev:
1.70
date: 2019/03/21 18:18:27
- user: cg
- file: DirectoryContents.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Claus Atzkern
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.
Filename
FileStream
DirectoryStream
OperatingSystem
accessing
-
cachedDirectoryNamed: aFileOrString
-
answer the valid cached directory or nil
-
directoryNamed: aDirectory
-
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
-
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 open, 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
-
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
-
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
|