I used this because here it's the folder which doesn't exist so I didn't know if FileDoesNotExist were a good idea, here it's as you want. 2016-04-26 11:24 GMT+02:00 Cyril Ferlicot Delbecque < cyril.ferlicot@gmail.com>:
On 26/04/2016 10:34, Valentin Ryckewaert wrote:
Hi !
I made this if it's ok for you i'll post it on fogbugs :
AbstractFileReference createFile "Create if necessary a file for the receiver. If the parent does not exist return an exception" self parent ensureCreateDirectory. self writeStream close. createDirectory "Verifies that the directory does not exist and only creates if necessary. Do not remove files contained if they exist.If the parents does not exist return an exception" self parent exists ifFalse:[self error:'The parent directory does not exist']. ^ self resolve ensureCreateDirectory ensureCreateFile "Create if necessary a file for the receiver. If the parent does not exist creates it" self parent ensureCreateDirectory. self writeStream close. ensureCreateDirectory "Verifies that the directory does not exist and only creates if necessary. Do not remove files contained if they exist.If the parents folder does not exist create it" ^ self resolve ensureCreateDirectory
Hi,
I think that createDirectory should raise a FileDoesNotExist instead of an Exception.
BTW, this may be good to discuss in another issue but we have a FileDoesNotExistException and a FileDoesNotExist in the image. Maybe we can unify both? Or if there is a difference we can explain it in the class comment because I don't see the difference.
-- Cyril Ferlicot
165 Avenue Bretagne Lille 59000 France