SpecialFolder.Resource and Build step CopyFiles

Hi All,

I have some template files that my app needs to read so in my project folder I created a folder called Resources and put them there and then tried to access them using the the SpecialFolder.Resource option and I got a NilObjectException.
So I looked in the debug folder and there was not a folder called Resources. I was, incorrectly, thinking that anything in the Resources folder would just be copied over. OK, fine it doesn’t.
So then I add the files to the Copyfiles build step. Still no Resources folder in the debug build, but the files are copied to the “CurrentWorkingDirectory”.

What am I missing? I would have expected the folder “Resources” created and the template files there, but that does not seem to be the case.

OK. So I figured out that I need to add the FOLDER to the CopyFile step and it will copy the folder and the items in it.
But now I am getting a Nil Object Exception.

Var f As New FolderItem

f  = SpecialFolder.Resources.Child("template01.txt")

If f.Exists Then
  MessageBox("File Found")
Else
  MessageBox("File not found")
End If

If I don’t specify “.Child” it gives me a compile error that says I am trying to use it as an array.
f = SpecialFolder.Resources("template01.txt")
Which makes sense since this should, without specifying “Child” be returning a Folder and not a File.

However the documentation shows as an example:
Var file As FolderItem = SpecialFolder.Resource("MyDb.sqlite")

So what boneheaded thing am I doing wrong?

SpecialFolder.Resource and SpecialFolder.Resources are different things.

Thanks @Tim_Hare
That was a tad bit maddening.