--- a/Filename.st Mon Feb 18 17:22:24 2002 +0100
+++ b/Filename.st Tue Feb 19 11:57:23 2002 +0100
@@ -3612,10 +3612,10 @@
sep := self separator.
sepString := sep asString.
(nameString = sepString) ifTrue:[
- "/
- "/ the trivial '/' case
- "/
- ^ nameString
+ "/
+ "/ the trivial '/' case
+ "/
+ ^ nameString
].
"/
@@ -3623,34 +3623,31 @@
"/
p := nameString.
[p endsWith:sepString] whileTrue:[
- (p = sepString) ifTrue:[
- ^ p
- ].
- p := p copyWithoutLast:1
+ (p = sepString) ifTrue:[
+ ^ p
+ ].
+ p := p copyWithoutLast:1
].
"/ strip off trailing components
index := p lastIndexOf:sep startingAt:p size.
index == 0 ifTrue:[
- "/ no separator found
- p = '.' ifTrue:[
- ^ '..'
- ].
- p = '..' ifTrue:[
- ^ '../..'
- ].
- ^ '.'
+ "/ no separator found
+ p = '.' ifTrue:[
+ ^ '..'
+ ].
+ p = '..' ifTrue:[
+ ^ '../..'
+ ].
+ ^ '.'
].
rest := p copyFrom:(index+1).
- rest = '.' ifTrue:[
- ^ p , '.'
- ].
- rest = '..' ifTrue:[
- ^ p , '/..'
+ (rest = '.' or:[rest = '..']) ifTrue:[
+ ^ self pathName asFilename directoryName
].
index == 1 ifTrue:[
- ^ '/'
+ ^ '/'
].
^ p copyTo:(index - 1)
@@ -3662,7 +3659,7 @@
'/foo/bar' asFilename directoryName
'bitmaps' asFilename directoryName
'bitmaps' asFilename directoryPathName
- '.' asFilename directoryName
+ '.' asFilename directoryName
'.' asFilename directoryPathName
'..' asFilename directoryName
'..' asFilename directoryPathName
@@ -4222,6 +4219,6 @@
!Filename class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.211 2002-02-12 11:34:40 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.212 2002-02-19 10:57:23 cg Exp $'
! !
Filename initialize!