Hello,
I want to save my XML file, this links some Pictures and Videos which also should be saved.
I want to have my own subfolder with all theses files under it.
I works pretty well with some of the Application…path Folders, but everytime I turn the hololens completly off or maybe put a new Version of my App onto it, all data is lost again.
It should also be a Folder I can Access with the Browser plugins file-Explorer if possible. It should not be the one drive, my app should also work offline.
I have tried all These Folders:
#if !UNITY_EDITOR && UNITY_METRO
//Globals.DataPath = Windows.Storage.ApplicationData.Current.RoamingFolder.Path;
//Globals.DataPath = Application.streamingAssetsPath;
//Globals.DataPath = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
//Globals.DataPath = Application.dataPath;
//Globals.DataPath = Application.persistentDataPath;
//Globals.DataPath = Windows.Storage.KnownFolders.CameraRoll.Path; // no Access possible?
//Globals.DataPath = Windows.Storage.KnownFolders.DocumentsLibrary.Path;// no Access possible?
Globals.DataPath = Application.persistentDataPath;
#else
// for running in unity editor
Globals.DataPath = Application.persistentDataPath;
#endif
Those with comment do not work at all, the others work but do not store the data permanent.
What should I do? Where is a path I can Access to store my data, without losing the data each time I install a new App Version or turn the hololens completly off?
Thanks a lot!
Thanks a lot for the hint.
Just to make sure:
I have an app which is a Kind of Knowledge assistant and it’s Editor. The data is an XML file with Texts, Pictures and Videos.
I want to store / save the file somewhere on the hololens, and also the Pictures and Videos. I would like to save it somewhere not in the Gallery (where every user of the hololens can delete parts of it), and it must be still there after I shut down or installed an app update.
I had a look. For me this seems to be some Kind of file dialogues that use an uwp file System.
That’s not what I Need (I know my filename, do not want to pick it manually), but I gave it a try to see if it helps.
I found this Code and wanted to open a file just to try out:
#if NETFX_CORE
public async void OpenFileAsync()
{
UnityEngine.WSA.Application.InvokeOnUIThread(async() =>
{
FileOpenPicker openPicker = new FileOpenPicker();
openPicker.ViewMode = PickerViewMode.Thumbnail;
openPicker.SuggestedStartLocation = PickerLocationId.Objects3D;
openPicker.FileTypeFilter.Add(".fbx");
StorageFile file = await openPicker.PickSingleFileAsync();
if (file != null)
{
// Application now has read/write access to the picked file
Debug.Log("Picked file: " + file.DisplayName);
}
else
{
// The picker was dismissed with no selected file
Debug.Log("File picker operation cancelled");
}
}, false);
}
#endif
And when I start it, it now asks me to install One Driver or some other app from the store.
My app is meant to work offline, One Drive may be an additional Feature later, but right now I only want to store an XML file and some Pictures and Videos to the hololens Hardware.
Can you Point me somewhere?
Thanks!
PS: I now installed One Drive on the hololens.
The above Code now opens a One Drive dialogue.
I just want to open and save a file on some known Location on the hololens where it is not deleted from an app update or hololens shutdown…
PPS:
When I use
Windows.Storage.ApplicationData.Current.LocalCacheFolder.Path;
it seems to survive the shutdown and restart of the hololens. But when I deploy the app again, all files are gone…
It could be VS reinstalls the applications, causing the app local data to be lost.
Yes. That is a huge Problem. How do I prevent it. There must be some way to store something on the hololens (please do’nt say One Drive, the hololens is sometimes not online, that is one Advantage, you can carry it around)…
Thanks for helping!
Indeed, like I said before. Just tested it again. Same for all known Folders which I tried and where I am allowed to save something!