eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'FileDirectory':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: FileDirectory


Inheritance:

   Object
   |
   +--Collection
      |
      +--FileDirectory

Package:
stx:libcompat
Category:
Compatibility-Squeak
Version:
rev: 1.67 date: 2018/10/10 18:38:49
user: stefan
file: FileDirectory.st directory: libcompat
module: stx stc-classLibrary: libcompat
Author:
Claus Gittinger

Description:


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 | ...]'.


Related information:

    Filename
    FileStream
    DirectoryStream
    OperatingSystem

Class protocol:

Compatibility-Squeak
o  default

o  localNameFor: aFileNameString

o  pathNameDelimiter

o  slash

initialization
o  initialize
(comment from inherited method)
setup the signal

o  update: something with: aParameter from: changedObject
(comment from inherited method)
dependent is notified of some change -
Default is to try update:with:

instance creation
o  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) **

o  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) **

o  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) **

o  on: aDirectoryPathName

** This is an obsolete interface - do not use it (it may vanish in future versions) **

o  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
o  fullPathNameOf: name in: path
is it an absolute path ?

** This is an obsolete interface - do not use it (it may vanish in future versions) **


Instance protocol:

Compatibility-Squeak
o  assureExistence

o  containingDirectory

o  deleteDirectory: dirName
Squeak/ST80 compatibility

o  deleteFileNamed: fileName
Squeak/ST80 compatibility

o  directoryEntryFor: name
(FileDirectory directoryNamed:'.') entries

o  directoryExists: dir
Squeak/ST80 compatibility

o  directoryNames
Squeak/ST80 compatibility

o  entries

o  fileExists: dir
Squeak/ST80 compatibility

o  fileNames
Squeak/ST80 compatibility

o  fileNamesMatching: pattern
Same as directoryContents, but returns only files
that matches given patterns. This uses String>>matches:
for pattern matching.

o  forceNewFileNamed: fn
Squeak/ST80 compatibility

o  includesKey: name
Squeak/ST80 compatibility

o  oldFileNamed: fn
Squeak/ST80 compatibility

o  readOnlyFileNamed: fn
Squeak/ST80 compatibility

o  recursiveDelete

accessing
o  baseName
return my baseName
- that's the directory name without leading parent-dirs

o  contents
return a collection with all files and subdirectories in the receiver.
Skips any '.' or '..' entries (UNIX)

o  directories
return a collection with all subdirectories in the receiver directory

o  directoryName
return my directoryName
- that's the directory name where I'm in

o  files
return a collection with all plain files in the receiver directory

o  pathName
return my full pathname

o  pathName: dirName
set my pathname; return nil if not a valid path; self otherwise

basic
o  changeAccessModeOf: name to: modeBits
set the access-mode bits (rwxrwxrwx) of a file in myself

o  createDirectory: newName
create a new filedirectory as a subdirectory of myself;
return true if successful

o  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) **

o  remove: aFileOrDirectoryName
remove the file or directory from myself; return true if successful

o  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.

o  removeFile: fileName
remove the file 'fileName' from myself; return true if successful

o  renameFile: oldFileName newName: newFileName
rename the file; return true if successful

converting
o  asFilename
return myself as a filename

o  asFilename: someFile
return a filename for a file named someFile in myself

enumerating
o  allDirectoriesDo: aBlock
evaluate the argument, aBlock for every directory name
in the directory and in all subdirectories

o  allFilesDo: aBlock
evaluate the argument, aBlock for every file name in the directory and in all
subdirectories

o  directoriesDo: aBlock
evaluate the argument, aBlock for every subdirectory name in the directory

o  do: aBlock
evaluate the argument, aBlock for every name in the directory

o  filesDo: aBlock
evaluate the argument, aBlock for every plain file name in the directory

o  namesDo: aBlock
evaluate the argument, aBlock for every name in the directory.
for ST-80 compatibility

o  where: testBlock do: aBlock
evaluate the argument, aBlock for every object in the directory
for which testBlock evaluates to true.

instance creation
o  directoryNamed: aName
create & return a new fileDirectory for a subdirectory in myself

printing & storing
o  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.

o  storeOn: aStream
append a printed representation of the receiver to aStream,
which allows reconstructing it via readFrom:

private
o  filenameFor: fileName
return a filename representing the argument, fileName
either in myself (if the arg is a releative path) or absolute otherwise.

o  fullNameFor: fileName
return a filename representing the argument, fileName
either in myself (if the arg is a releative path) or absolute otherwise.

o  getFullPathName
make my pathname be a full pathname - i.e. starting at root

o  pathNameOf: fileName
return the pathname for an entry in myself

queries
o  accessModeOf: name
return the access-mode bits (rwxrwxrwx) of a file in myself

o  exists
return true if this directory exists

usage example(s):

     (FileDirectory directoryNamed:'fooBar') exists
     (FileDirectory directoryNamed:'/tmp') exists

o  exists: name
return true, if the given name exists in myself

o  id
return the directories file-id (inode number)

o  infoOf: name
return an array filled with file info for the file 'aFileName';
return nil if such a file does not exist

o  isDirectory
return true, if the receiver represents a directory

o  isDirectory: name
return true, if the given name is that of a directory in myself

o  isExecutable: name
return true, if the given file is executable

o  isReadable: name
return true, if the given file is readable

o  isWritable: name
return true, if the given file is readable

o  species
return the type of collection to be returned by collect, select etc.

o  timeOfLastChange
return the timeStamp of myself

o  timeOfLastChange: name
return the timeStamp of a file in myself

o  typeOf: name
return the symbolic type of a file in myself

testing
o  isEmpty
return true, if the directory is empty;
redefined since '.' and '..' do not count as entries here.


Private classes:

    DirectoryEntry


ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sat, 20 Apr 2024 05:53:17 GMT