--- a/Filename.st Fri May 19 15:33:11 1995 +0200
+++ b/Filename.st Wed May 24 14:44:58 1995 +0200
@@ -20,7 +20,7 @@
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.25 1995-05-01 21:29:49 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.26 1995-05-24 12:42:19 claus Exp $
'!
!Filename class methodsFor:'documentation'!
@@ -41,7 +41,7 @@
version
"
-$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.25 1995-05-01 21:29:49 claus Exp $
+$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.26 1995-05-24 12:42:19 claus Exp $
"
!
@@ -200,7 +200,7 @@
"ST-80 compatibility.
what does this do ? (used in FileNavigator-goody)"
- ^ '/'
+ ^ #('/')
! !
!Filename methodsFor:'instance creation'!
@@ -538,6 +538,19 @@
"
!
+isSymbolicLink
+ "return true, if the file represented by the receiver is a symbolic
+ link. Notice that not all OS's support symbolic links; those that do
+ not will always return false."
+
+ ^ OperatingSystem isSymbolicLink:nameString
+
+ "
+ 'Make.proto' asFilename isSymbolicLink
+ 'Makefile' asFilename isSymbolicLink
+ "
+!
+
filesMatching:aPattern
^ self directoryContents select:[:name | aPattern match:name]
@@ -663,19 +676,73 @@
info
"return the files info; that is a collection of file attributes,
(actually a dictionary) where the keys are #type, #uid, #gid, #size etc.
- The actual amount and detail returned may depend on the OS used."
+ The actual amount and detail returned may depend on the OS used.
+ On unix, if you ask for the info of a symbolic link, the target
+ files info is returned.
+
+ On unix, the contents is:
+ id -> the inode number (integer)
+ uid -> the numeric user id of the files owner
+ gid -> the numeric group id of the files owner
+ statusChanged -> the absoluteTime when the files status changed last
+ (i.e. protection change, owner change etc.)
+ accessed -> the absoluteTime when the file was last accessed
+ modified -> the absoluteTime when the file was last modified
+ size -> the size (in bytes) of the file
+ type -> the files type (#regular, #directory, #characterSpecial)
+ mode -> the files access protection bits (rwxrwxrwx mask).
+
+ The minimum returned info (i.e. on all OS's) will consist of at least:
+ modified
+ size
+ type
+
+ Some OS's (VMS) may return more info.
+
+ Dont expect things like uid/gid/mode to be there; write your application
+ to either handle the cases where info-entries are not present,
+ or (better) use one of isXXXX query methods.
+ "
^ OperatingSystem infoOf:nameString
"
Filename currentDirectory info
+ '/dev/null' asFilename info
'Make.proto' asFilename info
+ 'source/Point.st' asFilename info
+ '../../libbasic/Point.st' asFilename info
+ "
+!
+
+linkInfo
+ "return the files info if its a symbolic link; nil otherwise.
+ On OS's which do not support symbolic links, nil is always returned.
+ The information is the same as returned by #info, except that
+ information for the symbolic link is returned (while #info returns
+ the info of the target file, accesed via the symbolic link).
+
+ In addition to the normal entries, Unix returns an additional entry:
+ path -> the target files pathname
+
+ See the comment in #info for more details."
+
+ ^ OperatingSystem linkInfoOf:nameString
+
+ "
+ Filename currentDirectory linkInfo
+ '/dev/null' asFilename linkInfo
+ 'Make.proto' asFilename linkInfo
+ 'Make.proto' asFilename linkInfo at:#path
+ 'source/Point.st' asFilename linkInfo
+ '../../libbasic/Point.st' asFilename linkInfo
"
!
dates
"return the files modification and access times as an object (currently a dictionary)
- that responds to the at: message with arguments #modified, #accessed or #statusChanged."
+ that responds to the at: message with arguments
+ #modified, #accessed or #statusChanged."
|info dates|