FindFirstFileEx in UWP Application

Sean Kelly 96 Reputation points
2019-12-27T12:29:38.447+00:00

I am working on porting a pre-existing C++ project to run in a UWP container. Also, this project is purely R&D and I will not be publishing to the store (restricted APIs are okay for me).

This project's build system outputs a very simple 'package index' which it traverses at runtime to find available plugin DLLs. This package index is essentially a directory tree with basic text files for leaf nodes. It currently uses the FindFirstFileEx family of APIs to traverse this tree at runtime.

From MSDN, I see that FindFirstFileEx (and related) are available on UWP. However, I'm also targeting devices (HoloLens, IoT Core) where I won't necessarily have access to the filesystem to put the package index on the device. And so, I'd like to include this package index into the appx bundle and access it from there.

What I'm hoping to do is the following:

  1. Manually add this package index directory structure to my UWP project and mark it as 'content'
  2. Make a small modification to the pre-existing code's search path to make it search within the .applications' packaged files

I'm having trouble determining whether #2 is possible. Is it possible to access application content from the filesystem from within the UWP application via FindFirstFileEx?

Thanks.

Universal Windows Platform (UWP)
{count} votes

Accepted answer
  1. Sean Kelly 96 Reputation points
    2019-12-28T12:59:03.023+00:00

    Turns out this works as expected; not sure why it didn't the first time I tried.

    Steps:

    1. Add a file to the project
    2. Right click on it and choose properties
    3. Mark it as content, and select 'copy always' (this deploys it to the appx install directory)
    4. Provide a relative path to FindFirstFileEx, and it can successfully find files deployed inside the appx install directory
    0 comments No comments

0 additional answers

Sort by: Most helpful