Resources folder confusion?

Hey all,
Just a clarification needed: Does 2015r2.2 automatically look for files (text files, graphics, etc) in the Resources folder now? I’m having issues with my app not running with File Not Found errors now, even though i’ve copied all the files to the same folder as the .EXE, I believe.

I’m using (the first one for the IDE, the second for running the .EXE, just reading the text file, not writing):

Dim f as FolderItem #if DebugBuild f = getFolderItem("").Parent.Child("trackcity.txt") #else f = getfolderitem("trackcity.txt") #endif

Running it this way, where should the .EXE be? And where should the text file in the above example be located? I’m using Windows 10.

This has nothing to do with the Resources folder. GetFolderItem does not look there unless you tell it to. In your example, trackcity.txt should be in the same folder as the .exe (or project, if you’re running from the IDE). It doesn’t matter where that is, they just have to be together.

In 2015R4, there is an actual Resources folder, which is named by the name of the executable followed by a space, then Resources. Just like on Mac, all files dragged in the project go there.

Here is how you get to a picture called blue.jpeg dragged into the project :

dim appname as string =".exe","") dim resourcesFolder as FolderItem = GetFolderItem("").child(appname+" Resources") if resourcesFolder.exists then resourcesFolder.child("blue.jpeg").launch end if

No more need to copy manually the files next to the executable, or to worry about debug folder.

Ah, just got that the app looks for stuff (graphics, etc) you drag directly into the project in Resources now. Once I put the Resources folder in the app, it runs fine. Guess it makes changing out graphics in a project easier vs. recompiling again.

I assume i’m correct this includes music, sounds, etc. that are dragged into the project itself?

As far as I know, any file dragged into the project is placed into that Resources folder.

The best way to access the resources folder is to use the module I created called TPSF.
It gives you the correct location on Windows and Mac, and is compatible with all Xojo IDE versions (the Resources folder changed up on Windows a few versions back.)

Download it here
Subscribe to this thread to stay up to date

Sorry, Tim. Forgot. Of course TPSF is much easier to use :slight_smile:

Did this change again with 2016R1? If I drag or add a graphic file or sound file to the project, does it need to be in the Resources folder to work organically (like window backgrounds, etc) in the program?

If you’ve dragged the image in to the Navigator and set set the window background in the IDE or by picture object via code you won’t have to worry about the image location.

TPSF has moved to Github, and I’d recommend using it for special locations when using the old framework FolderItem

Is that a change in 2016R1 or 1.1? Because if I didn’t include the image itself with 2015R2.2 in the Resources folder, it wouldn’t display anything in the background, just a blank background.

If the image was dragged into the project in any version you should not have to worry about where its placed in the built app
The IDE handles that
Always has

[quote=269594:@Norman Palardy]If the image was dragged into the project in any version you should not have to worry about where its placed in the built app
The IDE handles that
Always has[/quote]

Is this the same if you just set it in the IDE, but not drag it into the project?

I’m confused as to what you mean

If its not dragged into the project you cant select it in any of the popups

For example: Compiled In 2015R2.2, if I remove the Resources folder from the main folder (it contains all the graphic files and sounds), the app refuses to run at all. I added all the sounds and backgrounds using the IDE dropdown menus, loaded from my main system hard drive. When I add the Resources file back, the app runs fine.

Is this normal for 2015R2.2 apps, and has this changed in any way with the recent release? Windows 10, fully updated.

Yeah dont remove stuff the IDE & compiler spit out (like resources) unless you want to break your app (as you found)
They put those there for a reason
Removing them is bound to have negative effects

And you don’t have to fiddle with that stuff directly anyway. If you dragged the file trackcity.txt into your app, you can access it in code as simply trackcity, just like a normal variable name. You shouldn’t ever have to create a folderitem for it.