Reputation: 1
Over the past several years, I have developed several technical apps that share much C++ code, particularly with regard to vector graphics. These apps have always run on both Windows and Linux. Lately, I have been working to get these apps working within the protected environments now being offered and encouraged for both operating systems. Like many before me, I am struggling with this issue of accessing app data in the Windows UWP environment.
It seems like it should be a simple matter, all I want from the operating system is the name of a directory where I can store and access some files. I don’t care what that name is or how much the OS wants to otherwise restrict access to it, I just want the name for a directory I can use.
Of course my research led me to this web page: https://learn.microsoft.com/en-us/uwp/api/Windows.Storage.ApplicationData#Windows_Storage_ApplicationData_LocalSettings. But the sample C++ code leaves much to be desired, such the required headers and library files. I can’t just drop that code into a .cpp file and get a directory name. It seems I need to set up an entire environment for winRT to have any hope of getting that code to be of use, but that is hardly a trivial matter and success has thus far eluded me. I don’t see why so much trouble should be required to obtain such a simple and crucial piece of information. I don’t otherwise have a desire to use winRT and it’s not a productive use of my time to understand all of its minutiae. It does not solve any of the objectives of my apps. I just want a simple function I can call from standard C++ to get a directory name. Is that too much to ask?
Frankly, Microsoflt is driving me toward the conclusion that it doesn’t want independent development of Windows apps. Developing for Linux is far easier. Linux does what an operating system needs to do without putting up unnecessary obstacles. I would very much like to have the apps running under Windows also, but there is a limit to how much time and effort I can put into that and Microsoft seems to push that requirement further with every iteration of its technology.
Upvotes: 0
Views: 1641
Reputation: 1
for anyone interested, i developed a library to retrieve a store app data directory with functions that can be called from from a desktop app. the source source and binary can be found at:
https://github.com/timhirrel/TdhWinRT
Upvotes: 0
Reputation: 11
ApplicationData is in Windows::Storage namespace, and in the first row of the c++ example it has to be
StorageFolder^ localFolder = Windows::Storage::ApplicationData::Current->LocalFolder;
unless you add using namespace Windows::Storage;
If you want to get the folder path as wchar_t*
const wchar_t* wPath = localFolder->Path->Data();
Upvotes: 1