On Mon, Jun 11, 2012 at 8:38 PM, Mariano Martinez Peck < marianop...@gmail.com> wrote:
> So if we now do: > > 'afileThatDoesntExist' asFileReference delete > > I get a PrimitiveFailed. If this is what we want, can I add: > > FileReference >> deleteIfExists > > self exists ifTrue: [ self delete] > > So I discussed in IRC and Camillo and Sean recommended to use #ensureDelete because it is concistent to ensureFile and ensureDirecotry etc... for me #ensureDelete sounds the opposite to what this method does because I am not ensuring anything, if fact, I won't remove anything if the file does not exist. Camilo also suggested to do FileReference >> deleteIfExists self deleteIfAbsent: [ ] FileReference >> deleteIfAbsent: aBlock self exists ifTrue: [self delete] ifFalse: [aBock value] What do you think? which one do you like more? #ensureDelete or #deleteIfExists? do you also agree to add the intermediate #deleteIfAbsent: ? Cheers > or something like that? because lots of places (tearDown of tests) I > want to remove crao which may or may not exist... > > thanks > > -- > Mariano > http://marianopeck.wordpress.com > > -- Mariano http://marianopeck.wordpress.com