or try

dir := (FileSystem workingDirectory / '..' / 'public' / 'testing' / 'test2.txt') ensureCreateFile.
dir writeStream.

On Sun, Mar 11, 2018 at 1:16 AM, Sven Van Caekenberghe <sven@stfx.eu> wrote:


> On 11 Mar 2018, at 09:42, H. Hirzel <hannes.hirzel@gmail.com> wrote:
>
> Hello
>
> This is a follow up question to 'How do I make sure a directory exists?'
>
> The answer to that question was
>
>�� �� �� ��dir := FileSystem workingDirectory / '..' / 'public'.
>�� �� �� ��dir ensureCreateDirectory.
>
>
> Now I want to create a writeStream.
>
>�� �� �� ��dir writeStream
>
> gives 'Unable to open file'

You want to write to a directory ?

You probably mean

dir := FileSystem workingDirectory / '..' / 'public'.
dir ensureCreateDirectory.
(dir / 'foo.txt') writeStreamDo: [ :out | out << 'bar' ].

You are probably also looking for

dir canonicalize.
(dir / 'foo.txt') canonicalize.

> It seems that I need to ask to resolve the relative path first.
> How does the proper code idiom look like?
>
>
> Regards
>
> Hannes
>