# SpecialFolder.Resource and Build step CopyFiles

**URL:** <https://forum.xojo.com/t/specialfolder-resource-and-build-step-copyfiles/78336>\
**Category:** General\
**Created:** [November 30, 2023, 1:47am UTC](https://forum.xojo.com/t/specialfolder-resource-and-build-step-copyfiles/78336 "2023-11-30T01:47:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Craig\_Boyd](https://forum.xojo.com/user_avatar/forum.xojo.com/craig_boyd/32/15397_2.png) [@Craig\_Boyd](https://forum.xojo.com/u/Craig_Boyd)\
**Post date:** [November 30, 2023, 1:47am UTC](https://forum.xojo.com/t/specialfolder-resource-and-build-step-copyfiles/78336/1 "2023-11-30T01:47:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Craig\_Boyd](https://forum.xojo.com/user_avatar/forum.xojo.com/craig_boyd/32/15397_2.png) [@Craig\_Boyd](https://forum.xojo.com/u/Craig_Boyd)\
**Post date:** [November 30, 2023, 2:09am UTC](https://forum.xojo.com/t/specialfolder-resource-and-build-step-copyfiles/78336/2 "2023-11-30T02:09:36Z")

</div>

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.

```auto
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?

---

<div class="post-metadata">

**Author:** ![Tim\_Hare](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_hare/32/176_2.png) [@Tim\_Hare](https://forum.xojo.com/u/Tim_Hare)\
**Post date:** [November 30, 2023, 2:41am UTC](https://forum.xojo.com/t/specialfolder-resource-and-build-step-copyfiles/78336/3 "2023-11-30T02:41:59Z")

</div>

SpecialFolder.Resource and SpecialFolder.Resources are different things.

---

<div class="post-metadata">

**Author:** ![Craig\_Boyd](https://forum.xojo.com/user_avatar/forum.xojo.com/craig_boyd/32/15397_2.png) [@Craig\_Boyd](https://forum.xojo.com/u/Craig_Boyd)\
**Post date:** [November 30, 2023, 3:07am UTC](https://forum.xojo.com/t/specialfolder-resource-and-build-step-copyfiles/78336/4 "2023-11-30T03:07:45Z")

</div>

Thanks @Tim_Hare  
That was a tad bit maddening.
