TextOutputStream.Append versus .Create followed by .Append

I know that it’s been asked and answered in various posts, but I’m running into an oddity with TextOutputStream.Append.

In my code, I depended on .Append to create the file requested if it didn’t exist and then append data to that empty file. This has worked fine until today when I tried running an old project on Windows 10 in 2018r1.1. I verified that I have permissions to write to the folder, but I’m getting an error when I try to “tos.WriteLine theString” after the call to Append.

The code looks like this:

Dim f As FolderItem
Dim tos As TextOutputStream

f = SpecialFolder.Temporary.Child(safetmpfile)
If f <> Nil Then
  tos = TextOutputStream.Append(f)
  If tos <> Nil Then
    tos.WriteLine theString
    tos.flush
    tos.close
  End If
End If

Am I wrong that .Append would create the file if it did not exist in prior versions of Xojo?

[quote=390993:@Tim Jones]but I’m getting an error when I try to “tos.WriteLine theString” after the call to Append.
[/quote]
Come on, you know better than to say that without providing the error message :wink:

No, you are correct. From the docs:

[quote]Opens the passed file so that text can be appended to existing text.
If no file exists at the specified location, one is created. If the file cannot be created or opened for appending, an IOException is raised. The append is done by calling Write or WriteLine.
[/quote]

Sorry - the IOException was what I received :D, but cutting that code and retyping it seems to have fixed the issue. I knew it HAD worked, but this was a RS2011 project that I was renovating, so had suspicions.