Hi FS users I'm puzzled by FS api. I want to create a file in a directory so I did
| wk | wk := FSFilesystem disk workingDirectory. (wk / 'CSS2') ensureDirectory worked Now I looked at ensureFile and I do not understand the code ensureFile "Create if necessary a file for the receiver." self writeStream close. Because I would like to be able to write in the file and now I do not see why closing it is good. Would be good to add comments to FSReference>>writeStreamDo: doBlock ifPresent: presentBlock "Create a file if not present and execute doBlock (with a stream) as argument, if the file is present execute the presentBlock." ^ self isFile ifTrue: [ presentBlock value ] ifFalse: [ self writeStreamDo: doBlock ] FSReference>>writeStreamIfPresent: presentBlock "Return a writestream on the receiver if it does not already exist or execute the presentBlock with no argument" ^ self isFile ifTrue: [ presentBlock value ] ifFalse: [ self writeStream ] I do not get why we do not get as argument to the presentBlock the file itself? I added method comments…. as usual. :( Camillo could you have a look at such comments and commit them? I published the package to the fs package. Would be good to cross check and that I add it in 1.4
FSReference-streams.st
Description: Binary data
Stef