Open RReverser opened 8 years ago
This module is a thin wrapper of JSRT API JsProjectWinRTNamespace
and doesn't have further logic to patch differences when used inside/outside of a UWP. From a first glance, patching the differences seems out of scope of this module.
@munyirik @aruneshchandra @Yongqu Do you have opinions?
@jianchun Patching the differences is rather a backup plan, I was wondering if it's possible to simulate the mentioned "package identity" so that all the APIs that rely on it, would still work.
It's not possible to do that i.e. make a desktop application impersonate a UWP application (aka WinRT/Store app). Some classes like ApplicationData are tied to UWP apps since app packages have their own storage folders. For example the LocalFolder property will point to the application's own local folder (e.g. C:\Users\MyName\AppData\Local\Packages\MyApp\LocalState) and not c:\Users\XYZ\AppData\Local. For a desktop app (i.e. Node.js (Chakra)) I think the way to do this would be to use environment variable. E.g. the local folder variable is LOCALAPPDATA.
For a desktop app (i.e. Node.js (Chakra)) I think the way to do this would be to use environment variable. E.g. the local folder variable is LOCALAPPDATA.
Yeah, except then need to rewrite code to retrieve folders in asynchronous manner (as you can't get StorageFolder by path synchronously in opposite to ApplicationData.current.*
items which pre-exist) which, in turn, affects all the code that depends on it and so on and so on. So I hoped it would be possible to simulate C:\Users\MyName\AppData\Local\Packages\MyApp\
via .\.uwp-package\
or anything that would give pre-defined paths via the same API for testing purposes.
Getting the following error when trying to get local/temp folders:
I read around and looks like it's been a common issue for various UWP test runners, and in this specific case it happens because we don't really have any AppData associated with the script, but wondering if it would be possible to shim such APIs so that they would use e.g. script's folder as a base.