volume handling.
--- a/Filename.st Thu Sep 24 16:54:26 1998 +0200
+++ b/Filename.st Thu Sep 24 20:48:35 1998 +0200
@@ -536,10 +536,10 @@
"
Filename rootDirectoryOnVolume:'/phys/idefix'
- Filename rootDirectoryOnVolume:'d'
+ Filename rootDirectoryOnVolume:'d:'
"
- "Modified: / 23.9.1998 / 16:33:08 / cg"
+ "Modified: / 24.9.1998 / 19:06:32 / cg"
!
tempDirectory
@@ -642,19 +642,34 @@
If the argument names an absolute path, the first component will be the
name of the root directory (i.e. '/')."
- |sep components|
+ |sep f vol rest components|
(self ~~ ConcreteClass) ifTrue:[
^ ConcreteClass components:aString
].
"/ the following works on Unix & MSDOS (but not on openVMS)
+ "/ However, MSDOS drive-letters and network drives are
+ "/ not correctly handled here.
sep := self separator.
- components := aString asCollectionOfSubstringsSeparatedBy:sep.
+ f := aString asFilename.
+ vol := f volume.
+ vol size ~~ 0 ifTrue:[
+ rest := f localPathName.
+ ] ifFalse:[
+ rest := aString
+ ].
+
+ components := rest asCollectionOfSubstringsSeparatedBy:sep.
components first isEmpty ifTrue:[
components at:1 put:(sep asString)
].
+
+ "/ prepend volume to first component (the root directory)
+ vol size ~~ 0 ifTrue:[
+ components at:1 put:(vol , (components at:1)).
+ ].
components last isEmpty ifTrue:[
^ components copyWithoutLast:1
].
@@ -662,13 +677,29 @@
"
Filename components:'/foo/bar/baz'
- Filename components:'/'
+ Filename components:'/'
Filename components:'foo/bar/baz'
Filename components:'foo/bar'
Filename components:'foo'
+ Filename components:'/foo'
+
+ Filename components:'\'
+ Filename components:'\foo'
+ Filename components:'\foo\'
+ Filename components:'\foo\bar'
+ Filename components:'\foo\bar\'
+ Filename components:'c:'
+ Filename components:'c:\'
+ Filename components:'c:\foo'
+ Filename components:'c:\foo\'
+ Filename components:'c:\foo\bar'
+ Filename components:'c:\foo\bar\'
+ Filename components:'\\idefix'
+ Filename components:'\\idefix\home'
+ Filename components:'\\idefix\home\bar'
"
- "Modified: 8.9.1997 / 00:30:57 / cg"
+ "Modified: / 24.9.1998 / 19:10:52 / cg"
!
directorySuffix
@@ -2995,6 +3026,6 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.135 1998-09-24 14:54:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.136 1998-09-24 18:48:35 cg Exp $'
! !
Filename initialize!