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 2016-04-26 10:34 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
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
2016-04-25 16:28 GMT+02:00 Stéphane Ducasse <stephane.ducasse@inria.fr>:
oui moi aussi je me demandais si on devait introduire une autre methode mais en fait le nouveau comportement est compatible donc je le ferais.
On 25 Apr 2016, at 13:58, Valentin Ryckewaert < valentin.ryckewaert@gmail.com> wrote:
Tu en penses quoi toi ? Je trouve ça illogique que ensureCreate ne signifie pas la meme chose pour un dossier ou pour un fichier.
---------- Forwarded message ---------- From: Valentin Ryckewaert <valentin.ryckewaert@gmail.com> Date: 2016-04-22 10:11 GMT+02:00 Subject: Re: [Pharo-users] ensureCreateFile To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
For me ensureCreateFolder is made to be sure the folder is created, if you make '/home/a/b/c/d' with a b c d not existing it will create all of them. ensureCreateFile should do the same thing no ?
2016-04-21 13:19 GMT+02:00 Peter Uhnák <i.uhnak@gmail.com>:
because it's like this
ensureCreateFolder : create the folder structure if necessary ensureCreateFile : create the file if necessary
I really don't see any gain from changing existing behavior and introducing potential problems. If I ask for file to be created, I don't expect that the system will suddenly start creating folders, that's a unintentional side effect. If you need it for your convenience, then it's dead-easy to implement without breaking existing stuff.
On Thu, Apr 21, 2016 at 10:35 AM, Denis Kudriashov <dionisiydk@gmail.com
wrote:
2016-04-21 9:55 GMT+02:00 Valentin Ryckewaert < valentin.ryckewaert@gmail.com>:
Yes but why ensureCreateFile then ? Why don't we juste create a message createFile as there is createFolder ? createFolder : create the folder createFile : create the file
ensureCreateFolder : create the folder and its parents if necessary ensureCreateFile : create the file and its parents if necessary
+1
-------------------------------------------- Stéphane Ducasse http://stephane.ducasse.free.fr http://www.synectique.eu / http://www.pharo.org 03 59 35 87 52 Assistant: Julie Jonas 03 59 57 78 50 03 59 35 86 16
S. Ducasse - Inria 40, avenue Halley, Parc Scientifique de la Haute Borne, Bât.A, Park Plaza Villeneuve d'Ascq 59650 France