|
Class: FileDirectory
Object
|
+--Collection
|
+--FileDirectory
- Package:
- stx:libcompat
- Category:
- Compatibility-Squeak
- Version:
- rev:
1.74
date: 2022/10/12 11:34:57
- user: stefan
- file: FileDirectory.st directory: libcompat
- module: stx stc-classLibrary: libcompat
DO NOT DIRECTLY REFER TO THIS CLASS OR USE IT OTHERWISE IN YOUR CODE:
Notice:
This class is obsolete and does work only under UNIX.
Use Filename instead. It is left here for squeak compatibility.
This class is not available in other ST-systems;
in contrast, VisualWorks provides a Filename class.
Therefore, Filename has taken over the functionality.
FileDirectories represent directories in the underlying host system.
They provide various methods to create/delete and query for files and/or
directories. Also, since FileDirectory inherits from Collection, it
provides all enumeration and testing protocol. For example, you can
loop over the filenames in a directory using 'aFileDirectory do:[:nm | ...]'.
copyrightCOPYRIGHT (c) 1989 by Claus Gittinger
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.
Compatibility-Squeak
-
default
-
-
localNameFor: aFileNameString
-
-
pathNameDelimiter
-
-
slash
-
initialization
-
initialize
-
(comment from inherited method)
setup the signal
-
update: something with: aParameter from: changedObject
-
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:
instance creation
-
currentDirectory
-
create and return a new FileDirectory for the current directory
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
directoryNamed: name
-
create and return a new FileDirectory for the directory
with given pathname
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
directoryNamed: name in: aFileDirectory
-
create and return a new FileDirectory for the directory with given name
in another FileDirectory
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
on: aDirectoryPathName
-
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
rootDirectory
-
create and return a new FileDirectory for the root directory
** This is an obsolete interface - do not use it (it may vanish in future versions) **
private
-
fullPathNameOf: name in: path
-
is it an absolute path ?
** This is an obsolete interface - do not use it (it may vanish in future versions) **
queries
-
isObsolete
-
Return if this class is considered an obsolete class
(it will be marked as such in the browser).
True is returned here for myself only; false for subclasses.
Obsolete subclasses must redefine this again.
Compatibility-Squeak
-
assureExistence
-
-
containingDirectory
-
-
deleteDirectory: dirName
-
Squeak/ST80 compatibility
-
deleteFileNamed: fileName
-
Squeak/ST80 compatibility
-
directoryEntryFor: name
-
(FileDirectory directoryNamed:'.') entries
-
directoryExists: dir
-
Squeak/ST80 compatibility
-
directoryNames
-
Squeak/ST80 compatibility
-
entries
-
-
fileExists: dir
-
Squeak/ST80 compatibility
-
fileNames
-
Squeak/ST80 compatibility
-
fileNamesMatching: pattern
-
Same as directoryContents, but returns only files
that matches given patterns. This uses String>>matches:
for pattern matching.
-
forceNewFileNamed: fn
-
Squeak/ST80 compatibility
-
fullName
-
Squeak/ST80 compatibility
-
includesKey: name
-
Squeak/ST80 compatibility
-
oldFileNamed: fn
-
Squeak/ST80 compatibility
-
readOnlyFileNamed: fn
-
Squeak/ST80 compatibility
-
recursiveDelete
-
accessing
-
baseName
-
return my baseName
- that's the directory name without leading parent-dirs
-
contents
-
return a collection with all files and subdirectories in the receiver.
Skips any '.' or '..' entries (UNIX)
-
directories
-
return a collection with all subdirectories in the receiver directory
-
directoryName
-
return my directoryName
- that's the directory name where I'm in
-
files
-
return a collection with all plain files in the receiver directory
-
pathName
-
return my full pathname
-
pathName: dirName
-
set my pathname; return nil if not a valid path; self otherwise
basic
-
changeAccessModeOf: name to: modeBits
-
set the access-mode bits (rwxrwxrwx) of a file in myself
-
createDirectory: newName
-
create a new filedirectory as a subdirectory of myself;
return true if successful
-
link: oldFileName to: newFileName
-
link oldFileName to newFileName in myself, return true if successful
** This is an obsolete interface - do not use it (it may vanish in future versions) **
-
remove: aFileOrDirectoryName
-
remove the file or directory from myself; return true if successful
-
removeDirectory: dirName
-
remove the directory 'dirName' from myself; return true if successful.
If the directory is not empty, the containing files/directories are also
removed.
-
removeFile: fileName
-
remove the file 'fileName' from myself; return true if successful
-
renameFile: oldFileName newName: newFileName
-
rename the file; return true if successful
converting
-
asFilename
-
return myself as a filename
-
asFilename: someFile
-
return a filename for a file named someFile in myself
enumerating
-
allDirectoriesDo: aBlock
-
evaluate the argument, aBlock for every directory name
in the directory and in all subdirectories
-
allFilesDo: aBlock
-
evaluate the argument, aBlock for every file name in the directory and in all
subdirectories
-
directoriesDo: aBlock
-
evaluate the argument, aBlock for every subdirectory name in the directory
-
do: aBlock
-
evaluate the argument, aBlock for every name in the directory
-
filesDo: aBlock
-
evaluate the argument, aBlock for every plain file name in the directory
-
namesDo: aBlock
-
evaluate the argument, aBlock for every name in the directory.
for ST-80 compatibility
-
where: testBlock do: doBlock
-
evaluate the argument, aBlock for every object in the directory
for which testBlock evaluates to true.
instance creation
-
directoryNamed: aName
-
create & return a new fileDirectory for a subdirectory in myself
printing & storing
-
printOn: aStream
-
append a user printed representation of the receiver to aStream.
The format is suitable for a human - not meant to be read back.
-
storeOn: aStream
-
append a printed representation of the receiver to aStream,
which allows reconstructing it via readFrom:
private
-
filenameFor: fileName
-
return a filename representing the argument, fileName
either in myself (if the arg is a releative path) or absolute otherwise.
-
fullNameFor: fileName
-
return a filename representing the argument, fileName
either in myself (if the arg is a releative path) or absolute otherwise.
-
getFullPathName
-
make my pathname be a full pathname - i.e. starting at root
-
pathNameOf: fileName
-
return the pathname for an entry in myself
queries
-
accessModeOf: name
-
return the access-mode bits (rwxrwxrwx) of a file in myself
-
exists
-
return true if this directory exists
Usage example(s):
(FileDirectory directoryNamed:'fooBar') exists
(FileDirectory directoryNamed:'/tmp') exists
|
-
exists: name
-
return true, if the given name exists in myself
-
id
-
return the directories file-id (inode number)
-
infoOf: name
-
return an array filled with file info for the file 'aFileName';
return nil if such a file does not exist
-
isDirectory
-
return true, if the receiver represents a directory
-
isDirectory: name
-
return true, if the given name is that of a directory in myself
-
isExecutable: name
-
return true, if the given file is executable
-
isReadable: name
-
return true, if the given file is readable
-
isWritable: name
-
return true, if the given file is readable
-
species
-
return the type of collection to be returned by collect, select etc.
-
timeOfLastChange
-
return the timeStamp of myself
-
timeOfLastChange: name
-
return the timeStamp of a file in myself
-
typeOf: name
-
return the symbolic type of a file in myself
testing
-
isEmpty
-
return true, if the directory is empty;
redefined since '.' and '..' do not count as entries here.
DirectoryEntry
|