I created a UWP application in VS2015 and deployed this to my windows 10 IOT device (RPI 3).
It's deployed to this folder:
C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\
Now when it runs, it has no file access rights.
I've tried to write in its own directory
, to read from c:\data
, to read from c:\mydir
(newly created, given every user full access rights) but no rights to read (or write).
The weird thing is that all the code examples to see under which account my application is running aren't available for iot apps.
The app's install directory is a read-only location.
Not all folders on your device are accesible by Universal Windows Apps. To make a folder accesible to a UWP app, you can use FolderPermissions tool. For example run FolderPermissions c:\test -e to give UWP apps access to c:\test folder. Note this will work only with native Win32 apis for eg. CreateFile2 and not with WinRT apis like StorageFolder, StorageFile etc.
To use Win32 api ReadFile you need utilize PInvoke. Code like this:
NOTE: Here are some unsafe code that may not be published to Store. But it is no bother to you if you just use it on Windows IoT core.