--- a/Filename.st Mon Sep 09 14:45:03 2019 +0200
+++ b/Filename.st Mon Sep 09 16:15:21 2019 +0200
@@ -6924,7 +6924,7 @@
^ self species named:
(self name
- , self species suffixSeparator asString
+ , self species suffixSeparator
, aSuffix asString)
"
@@ -6951,6 +6951,8 @@
'/foo/bar.c/baz.c' asFilename addSuffix:'st'
'/foo/bar.c/baz' asFilename addSuffix:'st'
"
+
+ "Modified: / 09-09-2019 / 16:14:44 / Stefan Vogel"
!
hasSuffix:aSuffixString
@@ -7109,13 +7111,20 @@
If the name already has a suffix, the new suffix replaces it;
otherwise, the new suffix is simply appended to the name."
+ |prefixName|
+
+ prefixName := self nameWithoutSuffix.
aSuffix isEmptyOrNil ifTrue:[
- ^ self.
+ prefixName = nameString ifTrue:[
+ "same filename"
+ ^ self.
+ ].
+ ^ self species named:prefixName
].
^ self species named:
- (self nameWithoutSuffix
- , self class suffixSeparator asString
+ (prefixName
+ , self class suffixSeparator
, aSuffix asString)
"
@@ -7129,7 +7138,10 @@
'.' asFilename withSuffix:nil
'abc.st' asFilename withSuffix:'o'
+ 'abc.st' asFilename withSuffix:$o
+ 'abc.st' asFilename withSuffix:''
'abc' asFilename withSuffix:'o'
+ 'abc' asFilename withSuffix:''
'a.b.c' asFilename withSuffix:'o'
'a.b.c.' asFilename withSuffix:'o'
'.b.c.' asFilename withSuffix:'o'
@@ -7145,6 +7157,7 @@
"Modified: / 07-09-1995 / 11:15:42 / claus"
"Modified: / 07-11-2006 / 13:58:45 / cg"
+ "Modified (comment): / 09-09-2019 / 15:42:45 / Stefan Vogel"
!
withoutSuffix