New procedure for copying files in 2015r3?

Hi. I recently updated to the latest version of Xojo. I have a pre-filled db that I need added to the project’s appdata folder. I’ve been using the CopyTo in Build Settings, and this has worked for me up until updating Xojo. Is there a new method for copying files to a folder?

What isn’t working for you? Haven’t seen any difference…

Hi Beatrix. So I added the Copy Files via Build Step. Added my db to the Coy Files. Destination set to Resources folder. In App.Open, I have the following method to see if the db is present, and if not, it adds. This has been working prior to 2015r3, and nothing changed in my coding/calling

[code] Dim sourceDB As FolderItem
#If TargetMachO
sourceDB = app.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“examRDDTR.sqlite”)
#elseif TargetWin32
sourceDB = GetFolderItem(“Resources”).Child(“examRDDTR.sqlite”)

If sourceDB <> Nil And sourceDB.Exists Then
// Create destination folder
Dim appData As FolderItem = SpecialFolder.ApplicationData
Dim appFolder As FolderItem = appData.Child(“com.visualveggies.rdpracticeexam”)

// Copy DB to destination

End If[/code]

I’m not aware of any differences in Copy Files.

Did you check if the DB file is actually in the Resources folder? What platform is causing trouble? What does sourceDB point to? Is it Nil? Is Exists False? Is your Copy Files step before or after the Build step (it should be after).

It seems my Xojo licenses may have expired and am about to renew. Do you think this would have any impact on what I’m experiencing, even through debugging?

No, not really.

Ok, so I just discovered something that may have an impact here. I just renewed my license (not that this matters, but was necessary to build the project). I went to the builds folder and into the Resources folder to see if the new db was present. Well there was a db in there but an older one I modified in a previous build. I built in a method to check if the db is newer, and if it is to delete the current one and replace it with the new one from the Resources folder. When I checked the Resources folder in Builds, it had the older db present. Then I went back to the previous folder in Builds where the Resources is, and there’s a new folder present that was not in any of my older project builds with any of my apps. The new folder is named “RD Practice Exam Resources”. Within this folder is the updatd db along with other files associated with the project, including a new image I added to this update, which was not present in the plain “Resources” folder

So my question now is, how do you call to check this other Resources folder for the new db? Is this something that’s changed in the Destination of the Copy Files property?

Is this all on Windows ?

Yes designing on Windows and will be building for Mac and Windows

Testing was done on Windows machine. Haven’t tried yet on Mac

It looks like the contents in the Mac Resources folder that I just built does contain the updated db. This is still in a folder called Resources, but the Windows build folder also created the folder named RD Practice Exam Resources, which is the folder containing the new db file

Yeah this has almost nothing to do with the Copy Files step but a change in how the built application is created.
That’s this change in Xojo

6231 Build Windows/Linux: built apps that include resources now creates a Resources folder which includes the app name in its folder name, just like the Libs folder. You can also rename it to just “Resources” after the fact, and the framework will find it just like the Libs folder.

Ok thanks Norman. So this would be performed after the project is built (change the name to Resources). What about during testing and debugging? I often like to make sure my method works during debugging/testing:
Find db file --> if newer available, delete old --> add in new file
Is this possible?

You could write a script that ran before the copy that removed or moved the old database to the new location.
Or one that ran AFTER the copy that renamed the new resources dir to just plain “Resources”.

Thanks for your help Norman!

I needed my resources to remain in one folder called ‘Resources’ (multiple shared apps) so I set the CopyFile to place the files in Parent with a sub-folder ‘Resources’.