Good catch! That's clearly a bug IMO. #extension should use #copyAfterLast: rather than #copyAfter:.

On the other, FSReferenceTest >> #testBaseAndExtension explicitly defines a test where it says:

"Note that the extension of a complex extension starts from the first period up until the end"


So why is Squeak-FileSystem neglecting the common standards in this case?

Best,
Christoph

Von: Squeak-dev <squeak-dev-bounces@lists.squeakfoundation.org> im Auftrag von Tony Garnock-Jones <tonyg@leastfixedpoint.com>
Gesendet: Donnerstag, 5. November 2020 19:31:44
An: The general-purpose Squeak developers list
Betreff: [squeak-dev] (FSPath / 'foo.bar.zot') extension = 'bar.zot'
 
Hi all,


Currently:

     (FSPath / 'foo.bar.zot') extension = 'bar.zot'

Should it be? I expected it to equal 'zot'.

For reference, in python3:

     os.path.splitext('foo.bar.zot') == ('foo.bar', '.zot')

and in racket

     (equal? (path-get-extension "foo.bar.zot") #".zot")


Tony