UWP Desktop Bridge & Local App Data virtualized folder location

自闭症网瘾萝莉.ら 提交于 2019-12-07 17:49:09

问题


I am in the process of converting a Win32 app (Zoom Player) to the UWP AppX model using the "Desktop Bridge" conversion tool.

Under the folder model introduced in Windows VISTA, the application's files that do not require create/write access are installed under the "Program Files" folder and files that require create/write access are Installed under the LocalAppData folder ("C:\Users\bLight\AppData\Local" when calling the "SHGetKnownFolderPath" WinAPI function with the FOLDERID_LocalAppData parameter).

My problem is the AppX file created by Desktop Bridge installs the files the installer targeted for installation to "FOLDERID_LocalAppData" (C:\Users\bLight\AppData\Local\Zoom Player) here:

C:\Program Files\WindowsApps\ZoomPlayer_12.5.0.0_x86__63ghcm0aqanjp\VFS\Users\ContainerAdministrator\AppData\Local\Zoom Player

And any subsequent read or write attempts after running the installed App are redirected to :

c:\users\bLight\appdata\local\packages\zoomplayer_63ghcm0aqanjp\LocalCache\Local\Zoom Player

This means the installed files can not be accessed.

Both the installer and the Win32 app use "SHGetKnownFolderPath" with the same parameters to retrieve the Local AppData folder.

Any ideas how I can resolve this?


回答1:


Any ideas how I can resolve this?

After conversion, AppData is redirected to the local app data store, which is a private store for each UWP app.

Please notice this scenario: Your app writes to the install directory for your app. For example, your app writes to a log file that you put in the same directory as your exe. This isn't supported, so you'll need to find another location, like the local app data store.

See Prepare your desktop app for conversion to UWP section in here

----------------Update 1----------------

Rob has provided the right direction in your MSDN question

Quote:

Is it impossible for the AppX installer to automatically place some files into the local app data folder?

Yes. The recommended pattern is to include the template files in the install package and then copy them to the local app data folder on first use. When an app package is installed it's just copied into the system. It doesn't run any initialization code. It doesn't know which users will run the app and doesn't have access to their user data. If a second user installs the app then the user gets a reference to the already-installed app and nothing new is copied or installed.

A normal Win32 installer doesn't only place files into the "Program Files" folder, it places editable files into the "Local AppData" folder

This seems a problem scenario, we will notice the related team to check it and refine the document.



来源:https://stackoverflow.com/questions/39395496/uwp-desktop-bridge-local-app-data-virtualized-folder-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!