PSF File Redirection Fixup Confusion

Copper Contributor

Hi.

 

I've been trying my hand at this problem for a few days now, but I feel like I've just been working myself in a circle, so I'm here now to ask this to some people who actually know what they're doing. Anyway, my problem is this:

 

I have an program that writes to the user's Documents folder. I'm using the KnownFolder section along with the Documents Folder GUID to try and redirect the program's writes to the Local AppData folder, but nothing I've tried has been able to stop the program's folder from appearing in regular Documents.

 

I've included below the KnownFolder snippet straight from my config.json file.

 

"knownFolders": [
    {
        "id": "{F42EE2D3-909F-4907-8871-4C22FC0BF756}",
        "relativePaths": [
            {
                "base": "",
                "patterns": [
                    ".*"
                ]
            }
        ]
    }
]

 

 

I guess my absolute question is whether or not this Fixup even has the capability to do this. Have I just misinterpreted what the File Redirection Fixup is for?

 

I hope my question has been clear enough, and I hope I can finally get a solution to my little conundrum here.

 

Thanks.

4 Replies

@Edwinfitz 

 

1) If your package does not contain any documents, the end user would not need the Psf/FRF to be able to write there.  Only files contained in the folder paths of your package need help to allow write access.

 

2) A quick review of the Psf/FileRedirection code shows that the Id field of the Json should not be the KnownFolderID Guid, but a name that is the VFS folder equivalent of the file system.  The readme.md for the FileRedirection lists the id values supported MSIX-PackageSupportFramework/fixups/FileRedirectionFixup at master · microsoft/MSIX-PackageSupportFr...  and the code supports this list.  The Documents folder is not part of it.

 

3) If there is a need to include files in the Documents folder in your package, I would recommend placing them elsewhere in the package and use a RunOnce package script from PsfLauncher that copies those files into the user's Documents folder the on the first run of the app.  You probably want all document files available to other apps and if the FRF controlled them they would be trapped in this app's container redirection area.  If you feel otherwise, please post some details so that we can better understand the scenario.

 

@TIMOTHY MANGAN 

 

Hi.

 

I don't mind the folder being controlled by the FRF, but my main problem is that no matter what I try the FRF never seems to redirect the Folder being written to Documents in the first place.

 

I got this idea after reading the documentation for the File Redirection Fixup, where it states in the 'id' section under 'knownFolders':

 

"A string identifier indicating the input to SHGetKnownFolderPath. This can be one of the strings listed below or a string of the form "{GUID}" for some KNOWNFOLDERID value."

 

I have to ask again if the FRF even has the capability to do this. I'm still a bit worried that I'm just running a fools errand here. Although thank you for bringing up package scripts, for some reason it never crossed my mind to try and use one for this manner. I'll try working with those if my initial question turns out to be impossible.

 

Thanks.

@Edwinfitz 

 

Currently, the FRF does not support this.  Could it?  Sure.  I've added several other folders to that list in the past.  We have not included it because it seemed bad for the customers.  They might create a file in your app and then be unable to email to someone or use some other app with the file.  Thus the documents folder (as well as other places like the desktop) are currently not covered by the FRF.

 

If you can explain the scenario of how it is needed, we (well, probably I) can consider adding in support into the FRF.

 

Regards,

 

Tim Mangan (not a Microsoft employee)

@TIMOTHY MANGAN 

Oh, another thought.

 

The FRF can handle redirection of a file in the documents folder by using relative path within the config.json instead of KnownFolderId.

 

Tim