Best practices for accessing files when making app for both iOS and MAC/PC


i implemented an application that needs to read a couple of CSV files at the start. It was fairly straight forward for the desktop application, I just used the absolute path here, but I am kind of clueless how to, firstly deploy and secondly access the files on my iPad. It probably will done using the


method. But is there a way that handles it for both platforms?


Two options:

If the file never changes you can embed it into your binary by adding the file to your jucer project, clicking on the folder in the browser and selecting “binary resource.” The file will be converted to bytes and available as a char array named BinaryData::my_file_csv whose length is BinaryData::my_file_csvSize.

If the file needs to change you are pretty much free to put it anywhere on PC, although conventionally you’d want to put it in C:/User/AppData/YourCompany/YourApp/ or (occasionally) C:/User/Documents/YourCompany/YourApp.

On MacOS/iOS you’ll want to put it in the Resources folder of your app’s package, which you can do by selecting the “Xcode Resource” option in the projucer. In this case you’ll find the file in Applications/ You can find the package directory using SpecialLocationType::currentApplicationFile