FolderItem is not found on Creation

When I create a FolderItem, it is frequently created with LastErrorCode = 101 (Not found)

dim tempSave as FolderItem tempSave = destinationFile.Parent.child(fileName) // DestinationFile is a pre-existing file. We want to save in the same directory as it.

However creating a TextOutputStream with the FolderItem still seems to work.

Why is it throwing an error? Is it bad?

MacOS Mojava and Catalina
Xojo 2019 r1.1

That is probably why I stopped to use LastErrorCode in my projects :frowning:

That sounds normal if the save file doesn’t yet exist. You get a valid folderitem pointing to a not yet created (potential) file, so since it doesn’t exist, it should have a Not Found code.

No.

[quote=479039:@Tim Hare]
That sounds normal if the save file doesn’t yet exist. You get a valid folderitem pointing to a not yet created (potential) file, so since it doesn’t exist, it should have a Not Found code.[/quote]

You’re probably right though FolderItem.Exists = false makes sense but for it to log an error on creation seems odd…

Well, it has to look up the file to check for existence, so the last error code is whatever the OS reported. But I would ask, why are you checking LastErrorCode at this point anyway? It won’t have any useful information.

You’re probably right.

Just adding debugging to find an issue where sporadically it’s unable to create a TextOutputStream

It may be a permissions issue. It looks like you’re asking the user for a location to save the file but not actually using it. There isn’t enough code for me to know for sure, but I would definitely start there - especially on Catalina.