#BUGFIX by Micha
authorMichael Beyl <mb@exept.de>
Tue, 27 Sep 2016 14:48:59 +0200
changeset 20453 d90a2a56261c
parent 20452 8c97db3950fb
child 20454 4b44463a3054
#BUGFIX by Micha #BUGFIX by Micha class: Filename comment/format in: #asUniqueFilename do not remve e.g. apk in aaa.1.2.3.apk.txt
Filename.st
--- a/Filename.st	Tue Sep 27 14:41:41 2016 +0200
+++ b/Filename.st	Tue Sep 27 14:48:59 2016 +0200
@@ -2087,16 +2087,18 @@
     fn := baseFn := self.
     nextSeqNr := 0.
     [ fn exists ] whileTrue:[
-        |newFn|
+        |newFn suff|
         
         nextSeqNr := (nextSeqNr ? 0) + 1.
-        fn := (baseFn withoutSuffix name,'_',nextSeqNr asString) asFilename withSuffix:baseFn suffix.
+        suff := baseFn suffix.
+        suff notEmpty ifTrue:[ suff := '.',suff ].
+        fn := self class named:((baseFn withoutSuffix name,'_',nextSeqNr asString),suff).
     ].
     ^ fn
 
     "
      'aaa.txt' asFilename contents:'bla'.
-     'aaa.1.2.3.apk.txt' asFilename  asUniqueFilename PCFilename('aaa.1.2.3.apk_1.txt')contents:'bla2'.
+     'aaa.1.2.3.apk.txt' asFilename asUniqueFilename contents:'bla2'.
      'aaa.txt' asFilename asUniqueFilename contents:'bla3'.
      'aaa.txt' asFilename asUniqueFilename contents:'bla4'.
      #('aaa.txt' 'aaa_1.txt' 'aaa_2.txt' 'aaa_3.txt') do:[:f | f asFilename delete].