I am trying to create a folder in Application Data and place a file called TextFile in there. I keep getting I/O exception errors with this. Can anyone lend a hand?
dim appFolder as folderitem
appFolder = SpecialFolder.ApplicationData.Child("AppFolder").Child("TextFile")
appFolder.CreateAsFolder
dim numStream as TextOutputStream
if appFolder <> nil then
numStream = TextOutputStream.Create(appFolder)
if numStream <> nil then
numStream numbert.text
numStream.close
end if
end if
Your specifying the AppFolder and the TextFile on the same line, then trying to create a text file where you’ve just created a folder.
Worst:
I just fall into an error in a project where the construction was the same:
one (all) Childs does not exists
(none of the passed Child folders exists in my Boot SSD.)
appFolder = SpecialFolder.ApplicationData.Child("AppFolder")
appFolder.CreateAsFolder
Dim AppFile as Folderitem = AppFolder.Child("TextFile")
You should also check LastErrorCode from CreateAsFolder or at least check if it exists afterwards. Just in case that fails.