dsplaisted / PCLStorage

PCL Storage - Portable Storage APIs
Microsoft Public License
305 stars 94 forks source link

Looking for synchronous API #30

Open 1Cor125 opened 8 years ago

1Cor125 commented 8 years ago

Now that Universal Windows has support for returning to the System.IO.File, etc. API's with their synchronous method calls, we would like to see support in PCLStorage for synchronous calls. We think it preferable to retain the use of synchronous file IO patterns in Android and iOS code and update asynchronous Windows IO patterns to match that (rather than introduce the complexity of asynchronous file IO patterns into Android and iOS code). What is your opinion? Are there plans to support this in PCLStorage?

dsplaisted commented 8 years ago

I think that now that System.IO file APIs are available everywhere, there's not much of a need for PCL Storage. Is there a reason not to just use those APIs directly?

1Cor125 commented 8 years ago

Thanks for the quick response. So System.IO.File is available on all the platforms but I can’t access System.IO.File calls from within a portable lib so as I understand it I need some abstraction down there (like System.IO.Stream). Am I missing something?

On Jan 5, 2016, at 2:07 PM, Daniel Plaisted notifications@github.com wrote:

I think that now that System.IO file APIs are available everywhere, there's not much of a need for PCL Storage. Is there a reason not to just use those APIs directly?

— Reply to this email directly or view it on GitHub https://github.com/dsplaisted/PCLStorage/issues/30#issuecomment-169099655.

dsplaisted commented 8 years ago

Yes, a lot of the new ".NET Core" APIs are not currently available in PCLs targeting Xamarin. They should be eventually. So for now you would probably want to create your own abstraction if you want to use the APIs from a PCL.

1Cor125 commented 8 years ago

Would you consider it admissible to add synchronous implementations to the PCLStorage API?

dsplaisted commented 8 years ago

I would prefer not to add synchronous APIs to the PCLStorage package itself. They will be obsolete once the System.IO APIs are available in PCLs.

If you want a package with synchronous APIs in the meantime, I'd welcome a PR to create a separate package for that.

1Cor125 commented 8 years ago

Ok then. We may just write a thin abstraction around the File and Directory API's to tide us over. Thanks for your input.