Back: FileDescriptor-testing Up: Base classes Forward: FilePath class-file name management   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.74 FilePath

Defined in namespace Smalltalk
Superclass: Object
Category: Streams-Files
I expose the syntax of file names, including paths. I know how to manipulate such a path by splitting it into its components. In addition, I expose information about files (both real and virtual) such as their size and timestamps.

1.74.1 FilePath class: file name management  (class)
1.74.2 FilePath class: still unclassified  (class)
1.74.3 FilePath: accessing  (instance)
1.74.4 FilePath: converting  (instance)
1.74.5 FilePath: decoration  (instance)
1.74.6 FilePath: directory operations  (instance)
1.74.7 FilePath: enumerating  (instance)
1.74.8 FilePath: file name management  (instance)
1.74.9 FilePath: file operations  (instance)
1.74.10 FilePath: printing  (instance)
1.74.11 FilePath: still unclassified  (instance)
1.74.12 FilePath: testing  (instance)
1.74.13 FilePath: virtual filesystems  (instance)


1.74.1 FilePath class: file name management

append: fileName to: directory
Answer the name of a file named `fileName' which resides in a directory named `directory'.

extensionFor: aString
Answer the extension of a file named `aString'. Note: the extension includes an initial dot.

fullNameFor: aString
Answer the full path to a file called `aString', resolving the `.' and `..' directory entries, and answer the result. `/..' is the same as '/'.

pathFor: aString
Determine the path of the name of a file called `aString', and answer the result. With the exception of the root directory, the final slash is stripped.

pathFor: aString ifNone: aBlock
Determine the path of the name of a file called `aString', and answer the result. With the exception of the root directory, the final slash is stripped. If there is no path, evaluate aBlock and return the result.

pathFrom: srcName to: destName
Answer the relative path to destName when the current directory is srcName's directory.

stripExtensionFrom: aString
Remove the extension from the name of a file called `aString', and answer the result.

stripFileNameFor: aString
Determine the path of the name of a file called `aString', and answer the result as a directory name including the final slash.

stripPathFrom: aString
Remove the path from the name of a file called `aString', and answer the file name plus extension.


1.74.2 FilePath class: still unclassified

isAbsolute: aString
Answer whether aString is an absolute ptah.


1.74.3 FilePath: accessing

at: aName
Answer a File or Directory object as appropriate for a file named 'aName' in the directory represented by the receiver.

creationTime
Answer the creation time of the file identified by the receiver. On some operating systems, this could actually be the last change time (the `last change time' has to do with permissions, ownership and the like).

group: aString
Set the group of the file identified by the receiver to be aString.

includes: aName
Answer whether a file named `aName' exists in the directory represented by the receiver.

lastAccessTime
Answer the last access time of the file identified by the receiver

lastAccessTime: aDateTime
Update the last access time of the file corresponding to the receiver, to be aDateTime.

lastAccessTime: accessDateTime lastModifyTime: modifyDateTime
Update the timestamps of the file corresponding to the receiver, to be accessDateTime and modifyDateTime.

lastChangeTime
Answer the last change time of the file identified by the receiver (the `last change time' has to do with permissions, ownership and the like). On some operating systems, this could actually be the file creation time.

lastModifyTime
Answer the last modify time of the file identified by the receiver (the `last modify time' has to do with the actual file contents).

lastModifyTime: aDateTime
Update the last modification timestamp of the file corresponding to the receiver, to be aDateTime.

mode
Answer the permission bits for the file identified by the receiver

mode: anInteger
Set the permission bits for the file identified by the receiver to be anInteger.

owner: aString
Set the owner of the file identified by the receiver to be aString.

owner: ownerString group: groupString
Set the owner and group of the file identified by the receiver to be aString.

pathTo: destName
Compute the relative path from the receiver to destName.

refresh
Refresh the statistics for the receiver

size
Answer the size of the file identified by the receiver


1.74.4 FilePath: converting

asFile
Answer the receiver.


1.74.5 FilePath: decoration

all
Return a decorator of the receiver that will provide recursive descent into directories for iteration methods. Furthermore, iteration on the returned wrapper will not include '.' or '..' directory entries, and will include the receiver (directly, not via '.').


1.74.6 FilePath: directory operations

createDirectories
Create the receiver as a directory, together with all its parents.

createDirectory
Create the receiver as a directory, together with all its parents.

nameAt: aName
Answer a FilePath for a file named `aName' residing in the directory represented by the receiver.


1.74.7 FilePath: enumerating

allFilesMatching: aPattern do: aBlock
Evaluate aBlock on the File objects that match aPattern (according to String>>#match:) in the directory named by the receiver. Recursively descend into directories.

directories
Answer an Array with Directory objects for the subdirectories of the directory represented by the receiver.

do: aBlock
Evaluate aBlock once for each file in the directory represented by the receiver, passing a FilePath object (or a subclass) to it. It depends on the subclass whether iteration will include the '.' and '..' directory entries.

entries
Answer an Array with File or Directory objects for the contents of the directory represented by the receiver.

entryNames
Answer an Array with the names of the files in the directory represented by the receiver.

files
Answer an Array with File objects for the contents of the directory represented by the receiver.

filesMatching: aPattern
Evaluate aBlock once for each file in the directory represented by the receiver, passing a File or Directory object to aBlock. Returns the *names* of the files for which aBlock returns true.

filesMatching: aPattern do: block
Evaluate block on the File objects that match aPattern (according to String>>#match:) in the directory named by the receiver.

namesDo: aBlock
Evaluate aBlock once for each file in the directory represented by the receiver, passing its name. It depends on the subclass whether iteration will include the '.' and '..' directory entries.

namesMatching: aPattern do: block
Evaluate block on the file names that match aPattern (according to String>>#match:) in the directory named by the receiver.

reject: aBlock
Evaluate aBlock once for each file in the directory represented by the receiver, passing a File or Directory object to aBlock. Returns the *names* of the files for which aBlock returns true.

select: aBlock
Evaluate aBlock once for each file in the directory represented by the receiver, passing a File or Directory object to aBlock. Returns the *names* of the files for which aBlock returns true.


1.74.8 FilePath: file name management

directory
Answer the Directory object for the receiver's path

extension
Answer the extension of the receiver

full
Answer the full name of the receiver, resolving the `.' and `..' directory entries, and answer the result. Answer nil if the name is invalid (such as '/usr/../../badname')

fullName
Answer a String with the full path to the receiver (same as #name; it is useless to override this method).

name
Answer String with the full path to the receiver (same as #fullName).

parent
Answer the Directory object for the receiver's path

path
Answer the path (if any) of the receiver

stripExtension
Answer the path (if any) and file name of the receiver

stripFileName
Answer the path of the receiver, always including a directory name (possibly `.') and the final directory separator

stripPath
Answer the file name and extension (if any) of the receiver


1.74.9 FilePath: file operations

contents
Open a read-only FileStream on the receiver, read its contents, close the stream and answer the contents

fileIn
File in the receiver

open: mode
Open the receiver in the given mode (as answered by FileStream's class constant methods)

open: mode ifFail: aBlock
Open the receiver in the given mode (as answered by FileStream's class constant methods). Upon failure, evaluate aBlock.

open: class mode: mode ifFail: aBlock
Open the receiver in the given mode (as answered by FileStream's class constant methods)

openDescriptor: mode
Open the receiver in the given mode (as answered by FileStream's class constant methods)

openDescriptor: mode ifFail: aBlock
Open the receiver in the given mode (as answered by FileStream's class constant methods). Upon failure, evaluate aBlock.

pathFrom: dirName
Compute the relative path from the directory dirName to the receiver

readStream
Open a read-only FileStream on the receiver

remove
Remove the file identified by the receiver

renameTo: newName
Rename the file identified by the receiver to newName

symlinkAs: destName
Create destName as a symbolic link of the receiver. The appropriate relative path is computed automatically.

symlinkFrom: srcName
Create the receiver as a symbolic link from srcName (relative to the path of the receiver).

touch
Update the timestamp of the file corresponding to the receiver.

withReadStreamDo: aBlock
Invoke aBlock with a reading stream open on me, closing it when the dynamic extent of aBlock ends.

withWriteStreamDo: aBlock
Invoke aBlock with a writing stream open on me, closing it when the dynamic extent of aBlock ends.

writeStream
Open a write-only FileStream on the receiver


1.74.10 FilePath: printing

displayOn: aStream
Print a representation of the receiver on aStream.

printOn: aStream
Print a representation of the receiver on aStream.


1.74.11 FilePath: still unclassified

/ aName
Answer a File or Directory object as appropriate for a file named 'aName' in the directory represented by the receiver.


1.74.12 FilePath: testing

exists
Answer whether a file with the name contained in the receiver does exist.

isAbsolute
Answer whether the receiver identifies an absolute path.

isAccessible
Answer whether a directory with the name contained in the receiver does exist and can be accessed

isDirectory
Answer whether a file with the name contained in the receiver does exist and identifies a directory.

isExecutable
Answer whether a file with the name contained in the receiver does exist and is executable

isFile
Answer whether a file with the name contained in the receiver does exist and does not identify a directory.

isFileSystemPath
Answer whether the receiver corresponds to a real filesystem path.

isReadable
Answer whether a file with the name contained in the receiver does exist and is readable

isRelative
Answer whether the receiver identifies a relative path.

isSymbolicLink
Answer whether a file with the name contained in the receiver does exist and identifies a symbolic link.

isWriteable
Answer whether a file with the name contained in the receiver does exist and is writeable


1.74.13 FilePath: virtual filesystems

zip
Not commented.



Back: FilePath-testing Up: FilePath Forward: FileSegment   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on July, 23 2009 using texi2html