FolderItem error

This may not be an iOS issue but that is the type of app I am doing. At app.Open have this code

if f<>nil then
if f.Exists then
if NOT f.IsFolder then
//this should not happen but have to delete and create a folder
end if
end if

if f.IsFolder then
end if

end if

Stopped working as the app is almost complete. Debug halts at “if f.Exists then” with Xojo.IO.IOException. Details of exception are Reason=“The file “ca.GoldCreekLtd.PMPracticePad” couldn’t be opened” AND Underlying Error = “The operation couldn’t be completed. Not a directory.”

Ported this exact same code into a new project and it runs fine.
Anyone seen this type of thing? The only thing I have come up with is the project file is corrupted and I will have to start a new project and transplant everything to it.

The problem was in the Simulator file. Followed the path shown in Xojo IDE when the error occurred, moved file to trash and problem was gone. If something similar ever happens to you the path for MacOS will vary but will have the following format:
Users/[your name]/Library/Developer/CoreSimulator/Devices/[some long number]/data/Containers/Data/Application/[a folder with a long number which you want to throw away]