-
Notifications
You must be signed in to change notification settings - Fork 329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Microsoft.Storage.ApplicationData #2639
Comments
See #2621 (comment) for the latest discussion that sparked the creation of this issue |
Nit: I'd add the word reliably in there (e.g. only works reliably), just to bring attention to how evil this API truly is. Because the API does work most of the time, it misleads devs and puts them on a path to failure. Otherwise thanks for writing this up and moving the needle. I've been talking about these tricky APIs/scenarios since around 2017! |
Can you elaborate on what you find unreliable about ApplicationData.Current? Is it really unreliable or rather the complexity of having to understand the right contexts it does/not support (i.e. the Rationale's first 3 bullets)? |
|
Can definitely see the importance of getting a filesystem Path without EDIT: IDL in spec shows that both a StorageFolder and Path will be available for the given locations, so this seems like less of a statement on the future of StorageFolder and more about facilitating interoperability from non Windows.Storage APIs which take a filesystem path. Gets a 👍🏻 from me |
Bingo! :-) |
Just to let you know what I did (a manual and not an elegant solution) to walkaround the Windows.Storage.ApplicationData for now:
Edited: for my situation only as in discussion #2618 |
BTW that's not equivalent.
Windows.Storage.AppDataPaths.GetDefault().LocalAppData == SHGetKnownFolderPath(KnownFolderID_LocalAppData...) == %LOCALAPPDATA% == %USERPROFILE%\AppData\Local (but APIs are better than environment variables as the latter can be trivially altered/hacked; they're not reliable or definitive sources of the answer, those APIs are). 1 Maybe. ApplicationData for a package family exists under %USERPROFILE% if the package is installed on %SystemDrive% (i.e. C:) but if you install packages to other drives then their ApplicationData will be created on the same drive e.g. install a packaged app on Q: and ApplicationData.LocalFolder will likewise be located on Q: 2 But that's not absolute. If you then move the package to another drive the package moves but not the data e.g. pkgmgr.MovePackageAsync(foo,...) from Windows.ApplicationModel.Package.InstalledPath=Q:... to M:... but ApplicationData will still be on Q: |
* Microsoft.Storage.ApplicationData #2639 * Added details about per-machine data store * Incorporated feedback * Moar doc-comments * Removed ClearAllAsync and ClearMachineAsync. Use ClearAsync(locality) * Removed typo * Fixed some long-line formatting * Incorporated API Review feedback
Proposal: Microsoft.Storage.ApplicationData
Summary
Provide a modern enhanced version of Windows.Storage.ApplicationData and Windows.Management.Core.ApplicationDataManager
Microsoft-internal task 40050113
Rationale
Windows.Storage.ApplicationData.Current
only works if you have package identity AND running in AppContainerWindows.Management.Core.ApplicationDataManager.CreateForPackageFamily
is equivalent but requires you have package identity AND running MediumIL or higher%LOCALAPPDATA%\publisher\product
,%LOCALAPPDATA%\Temp
andHKCU\SOFTWARE\publisher\product
but ApplicationData doesn't support thatWindows.Storage.ApplicationData
has several deprecated and obsolete features (e.g. .RoamingFolder)ApplicationData.*Folder
only provide access to the filesystem viaStorageFolder
. There's no way to get their.Path
without going thrug aStorageFolder
incurring significant performance overheadApplicationData
has async methods which should be available synchronously e.g.ClearAsync()
should offer `Clear() as a synchronous variant (or replacement?)Windows App SDK can and should provide a modern revision of the
ApplicationData
API, addressing the issues above (one API supporting both packaged and unpackaged apps).Scope
Important Notes
Microsoft.Storage.ApplicationData supports packaged and unpackaged apps. The underlying data stores are different but equivalent(ish):
ApplicationData.LocalCacheFolder
%LOCALAPPDATA%\<publisher>\<product>
ApplicationData.LocalFolder
%LOCALAPPDATA%\<publisher>\<product>
ApplicationData.MachineFolder
%ProgramData%\<publisher>\<product>
ApplicationData.RoamingFolder
%LOCALAPPDATA%\Roaming
ApplicationData.TemporaryFolder
%LOCALAPPDATA%\Temp
ApplicationData.LocalSettings
HKCU\SOFTWARE\<publisher>\<product>
WinRT API
Here's a sketch of the general shape of the API to express the intent of the ask. The actual API when designed/spec'd/reviewed/approved may differ.
Microsoft.Storage.ApplicationData.idl
Open Questions
Q: Is there an unpackaged equivalent to GetPublisherCacheFolder()?
The text was updated successfully, but these errors were encountered: