LittleFunny
LittleFunny

Reputation: 8375

Xamarin PCLStorage package: What is the root folder this PCLStorage reference to

I saw this package on Xamarin page. To access the file system I can use PCLStorage.FileStream.Current.localStorage to get the current root storage of the device but which folder it referring to on device: Is it the application private folder or somewhere else?

Can we access other folders e.g. On android, there DOCUMENT, DOWNLOAD folders?

Upvotes: 1

Views: 961

Answers (1)

SushiHangover
SushiHangover

Reputation: 74114

PCLStorage source for LocalStorage:

#if ANDROID
var localAppData = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
#elif IOS
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

In Android this maps to the root of app's private storage, i.e.:

/data/data/{ApplicationID}/files

In iOS, this is mapped to the app's private Documents folder:

/data/data/{Package}/Documents

If your app requirements differ, you would need to mod the source of that project or provide your own platform code via a Xamarin.Forms dependency service.

Upvotes: 2

Related Questions