On Wed, Aug 17, 2016 at 9:44 PM, stepharo <stepharo@free.fr> wrote:
Hi
I have a file
/Users/ducasse/PharoMooc/Subtitles/W1/C019SD-W1-sous-titres- EN/EN_C019SD-W1-S1.srt
and I would like to generate a new one with a different extension
/Users/ducasse/PharoMooc/Subtitles/W1/C019SD-W1-sous-titres- EN/EN_C019SD-W1-S1.vtt
Why not just myFile withExtension: 'vtt'
To get everything except the extension. Is it not obvious?e.g.
f := '/tmp/file.txt' asFileReference."File @ /tmp/file.txt"f withExtension: 'log'"File @ /tmp/file.log"��
Now I'm browsing FileReference and I do not find an easy way to do it.
It's an AbstractFileReference method.
/Users/ducasse/PharoMooc/Subtitles/W1/C019SD-W1-sous-titres- EN/
Why not just #parent? Some languages also use #dirname.��/Users/ducasse/PharoMooc/Subtitles/W1/C019SD-W1-sous-titres- EN/EN_C019SD-W1-S1
This one is the one hard to get��� but how often do you need it? Is it worth the extra method in the API?If just for changing the extension, then there's #withExtension:��Proposal one:
�� �� We could add withoutExtension
�� �� withoutExtension
�� �� �� �� �� ��^�� (self parent / self basenameWithoutExtension)
What is the use case for this?
This is a helper.Proposal two:
�� �� We could add withoutBasename
�� �� withoutBasename
�� �� �� �� �� �� ^ self parent
I don't see a point of this method, why not just use #parent?
It is the same. I will add a real comment to this method.Proposal three:
Not sure that it is worth
(note that this is not a rename)
�� �� withNewExtension: anExtension
�� �� �� �� ^ self parent / self basenameWithoutExtension withExtension: anExtension
Is this somehow different than using #withExtension: directly?
Peter