I’m using System.IO to read and write to a text file kept in the root of Application.persistentDataPath for my Unity Android app. Once the user is done making changes in the app, I would like them to be able to click a button and be taken straight to the folder where they can email themselves, or someone else, the text file. (This process is necessary. I am unable to use a database to store this data for unrelated reasons.)
Using Application.Openurl() I can browse directly to the text file which opens the file contents:
Application.Openurl(Application.persistentDataPath + filename);
but from here the user is unable to share the file or go back a level to the folder the file is kept in.
What I want is this to work:
Application.Openurl(Application.persistentDataPath);
Notice how I’ve removed the file name. I’ve tried using the “file://” protocol and adding “/” at the end but nothing seems to work. The error I get when attempting to open the folder is: “Cannot display PDF: (file is of invalid format)” which is strange because there are no pdf documents in my persistent data folder and the path is just to a folder.
Any ideas on making this work? Everything work’s fine on desktop including opening just the folder. Opening the folder on Android is what I need help with.