Putting Files in Resouces Folder

I am interested in the Mac at the moment although I could imagine that I might have the equivalent question for Windows.
I am confused about the Resources folder.
I understand that it is not allowed (or at least not kosher) to have your application write to the Resources folder. It is supposed to be read only.

In Xojo the language you have access to a folder (Resources) with

SpecialFolder.Resource

I can imagine that if there was some file in this folder, my app could use the syntax
Var file As FolderItem = SpecialFolder.Resource(“someTextFile.txt”)
to access that file.

What is the proper way to put that file in this folder? Is it correct that I should not write code in my app to put it there? Does that imply that I should put it there manually? And does that imply that on the Mac I should use the Finder after some app (let’s call it MyApp) has been compiled to take the built MyApp (which is actually a “Project”) and right click to bring up Show Package Contents and then navigate to the folder Resources which is subfolder of Contents and manually put whatever files I want there?

Before I compile my app and am still debugging it, where is the Resources file and how do put files in it at that stage.

The depth of my confusion is probably obvious from this whole topic.

Either you make a Copy Files step and set the destination to the Resources folder:

When you drag files to the IDE they automatically end up in the Resources folder:

2 Likes

Thank you, Beatrix! I am amazed that for years I have dragged icons and other stuff to the Navigation area and used them in my code and it has just worked without my having any understanding of what was actually happening. Your explanation makes it so more coherent in my mind.

In any case, if you use the first technique (Copy Files step), then it would seem to make sense to use the
SpecialFolder.Resource in your code to access the individual files.

When you just drag stuff into the IDE, you can just refer to those files in your code by the names in the Navigation bar without bothering to use SpecialFolder.Resource. And in my old self’s case, without even realizing that they were in the Resources folder.

So it would seem that if I had an app with an accompanying SQLite database that was used to store data and which the app used to access data but never had a need to write data to, it would be reasonable to put the SQLite database file in the Resouces folder by one the means above.

Is that correct?

If you don’t write this should work. Maybe. I’d make a copy of the database into the Application Support folder.

Thank you for this important information.

I will remove all my files that I add to the navigation pane using Xojo 2015r1 as they are for the developer use, not for all eyes…

I put files in the Navigation pane that describes what the software do, how I do that, even with images and all kinds of comments !

I will also stop advertising this…

I will experiment the urls in the Comments (local urls) instead.