Copy over file from one folder in App Support to another

Hello. The issue below is on a Mac. Windows is performing this step fine without any issues, and also this is an app I am selling on my own website, not on the MAS.

I have made an update to the app, and part of this is to copy over some db files to the new App Data folder of the new app, so the user does not lose any of their data from using the old program. Below is the code I was using to accomplish this. However, I see that when I do a new install of the old app (rdpracticeexam), it stores the files on the Mac at:
Library\Containers\com.visualveggies.rdpracticeexam\Data\Library\Application Support\com.visualveggies.rdpracticeexam

The new app is storing at:
Library\Application Support\com.visualveggies.rdexamstudysuite

Both of these installer packages were built with App Wrapper, though, I just updated that software today before doing the studysuite package. Could that be the culprit? How can I modify the code below to copy the practiceexam files to the new studysuite folder?

[code] Dim dbFile As FolderItem
dbFile = SpecialFolder.ApplicationData.Child(“com.visualveggies.rdexamstudysuite”)

'see if files present in practiceexam folder then copy to new folder if present
dim oldDataFile as FolderItem
oldDataFile = SpecialFolder.ApplicationData.Child(“com.visualveggies.rdpracticeexam”).Child(“registerDB.sqlite”)

if dbFile.Exists = False then
dbFile.CreateAsFolder
end if
dbFile = dbFile.Child(“registerDB.sqlite”)

if oldDataFile <> Nil and oldDataFile.Exists then
// Copy DB to destination
oldDataFile.CopyFileTo(dbFile)
else
if dbFile.Exists = False then
Dim db As New SQLiteDatabase
db.DatabaseFile = dbFile
'code to creates table and connect… just omitted for post

  End If
end if

end if[/code]

[quote=288903:@Ryan Hartz]when I do a new install of the old app (rdpracticeexam), it stores the files on the Mac at:
Library\Containers\com.visualveggies.rdpracticeexam\Data\Library\Application Support\com.visualveggies.rdpracticeexam

The new app is storing at:
Library\Application Support\com.visualveggies.rdexamstudysuite[/quote]

You must have sandboxed the older app, and not the new one. If you sandbox the new app and if it has the same bundle ID, you will find the same path.

Thanks Michel. With the new app, I did change the bundle ID. So I changed it back to the original ID, and it copied the files to the new folder on one test machine, but on another, I got an fatal error to send the crash report to Apple

Plus, by doing this, the name of the app had not changed to the new name of the app.

Is there not a way to use the new bundle ID, so it creates two instances of the app (which I am ok with), and to just find the old files and copy to the new folder? Is this possible?

Figured how to get this to work. Had to use an extended path to find the old folder on Mac

dim oldDataFileUser as FolderItem #If TargetMachO oldDataFileUser = SpecialFolder.UserLibrary.Child("Containers").Child("com.visualveggies.rdpracticeexam").Child("Data").Child("Library").Child("Application Support").Child("com.visualveggies.rdpracticeexam").Child("userDB.sqlite") #elseif TargetWin32 oldDataFileUser = SpecialFolder.ApplicationData.Child("com.visualveggies.rdpracticeexam").Child("userDB.sqlite") #endif

So the older version was sandboxed? That would put the data files into a container folder, which is in a different location.

The function

SpecialFolder.ApplicationData.Child

Returns a different path between Sandboxed and non-Sandboxed applications, this is the correct behavior.

Hi Sam. Yes I believe so. During this testing of copying over the necessary files, I did a fresh install of the latest version (prior to the version working on now) on a machine, then tested an install of the new version. The old version’s app data files were in the long path, which I believe is sandboxed, and the new install’s was present in the ApplicationData folder

For both, I used App Wrapper. Though for the older version of my app, I was probably using a version of App Wrapper that was 3+ versions prior to what it is today. With the new install of the new app, I updated App Wrapper yesterday

Not sure if I had a specific setting set in the older package settings