I use the _stat function under UWP. But it repeatedly returns -1 for the absolute path to the file from my Images Library (C:\\Users\\<<my-user>>\\Pictures\\image_sample.png). I tried adding a permission to Images Library by adding to the manifest file the following:
<Capabilities>
<uap:Capability Name="picturesLibrary"/>
</Capabilities>
But it didn't help in my case. Different Windows' API function work well (like I can read this file using for example StorageFolder::GetFolderFromPathAsync). But the _stat returns -1.
_stat works on UWP well when I use the relative path for files inside the app sandbox. Is it possible to use it for an external directory (for example to pictures library)?
Use Capability broadFileSystemAccess, and enable the
File Systempermission in the app settings.You can search for your app in the Start Menu, click
App settings, and open tFile Systemin App permission. Another way, open Settings, Settings-> Privacy &security -> File System, find your app in the list and enable file permissions. (Win+Rms-settings:privacy-broadfilesystemaccess)I test UWP C++/WinRT project, follow the above steps to open file permissions,
_statworks well, it returns 0 and can use absolute path.