--- a/Filename.st Tue Jul 21 16:26:50 1998 +0200
+++ b/Filename.st Tue Jul 21 16:27:25 1998 +0200
@@ -1559,17 +1559,19 @@
"this returns a string describing the type of contents of
the file. This is done using the unix 'file' command,
(which usually is configurable by /etc/magic).
- On non-unix systems, this may return simply 'file',
+ On non-unix systems, this may simply return 'file',
not knowning about the contents.
Warning:
Since the returned string differs among systems (and language settings),
- it is only useful for user-information; NOT as a tag to be used by a program."
-
- |buffer s n suffix idx baseNm|
-
- "/ since executing 'file' takes some time, do the most obvious
- "/ ones here.
- "/ (also useful for systems, which have no file command, such as NT)
+ it is only useful for user-information;
+ NOT as a tag to be used by a program."
+
+ |type buffer s n suffix idx baseNm|
+
+ "/ since we cannot depend on a 'file' command being available,
+ "/ do the most obvious ones here.
+ "/ (also useful since the 'file' command takes some time, and the code
+ "/ below is faster for common things like directories)
self isSymbolicLink ifTrue:[
^ 'symbolic link to ' , (self linkInfo path)
@@ -1579,6 +1581,16 @@
self isExecutable ifFalse:[^ 'directory, locked'].
^ 'directory'
].
+ (type := self type) == #characterSpecial ifTrue:[
+ ^ 'character device special file'
+ ].
+ type == #blockSpecial ifTrue:[
+ ^ 'block device special file'
+ ].
+ type == #socket ifTrue:[
+ ^ 'socket'
+ ].
+
self isReadable ifFalse:[^ 'unreadable'].
self fileSize == 0 ifTrue:[^ 'empty'].
@@ -1639,7 +1651,7 @@
(buffer startsWith:'#') ifTrue:[
^ 'make rules'
]
- ]
+ ]
]
].
@@ -1648,12 +1660,13 @@
"
'Makefile' asFilename fileType
'.' asFilename fileType
- '/dev/null' asFilename fileType
+ '/dev/null' asFilename fileType
+ '/tmp/.X11-unix/X0' asFilename fileType
'smalltalk.rc' asFilename fileType
'bitmaps/SBrowser.xbm' asFilename fileType
"
- "Modified: 7.9.1997 / 23:43:48 / cg"
+ "Modified: / 21.7.1998 / 11:25:56 / cg"
!
id
@@ -2731,6 +2744,18 @@
!Filename methodsFor:'special accessing'!
+nameWithSpecialExpansions:aString
+ "return the nameString, expanding any OS specific
+ macros. This should be redefined for OS's where such macros
+ are common.
+ On unix, a ~/ prefix is expanded to the users home dir (as in csh)"
+
+ ^ aString
+
+ "Modified: / 21.7.1998 / 10:43:20 / cg"
+ "Created: / 21.7.1998 / 10:45:58 / cg"
+!
+
osName
"special - return the OS's name for the receiver."
@@ -2742,9 +2767,14 @@
osNameForAccess
"internal - return the OS's name for the receiver to
- access its fileInfo"
+ access its fileInfo.
+ This may be redefined for systems, where a special suffix must be
+ added in order to access directories (or others) as a file.
+ (i.e. under VMS, a '.dir' suffix is added to access directories)"
^ nameString
+
+ "Modified: / 21.7.1998 / 10:40:40 / cg"
!
osNameForDirectory
@@ -2890,6 +2920,6 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.121 1998-07-20 11:17:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.122 1998-07-21 14:27:25 cg Exp $'
! !
Filename initialize!