PSF File Redirection Fixup Confusion

%3CLINGO-SUB%20id%3D%22lingo-sub-2109559%22%20slang%3D%22en-US%22%3EPSF%20File%20Redirection%20Fixup%20Confusion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2109559%22%20slang%3D%22en-US%22%3E%3CP%3EHi.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20been%20trying%20my%20hand%20at%20this%20problem%20for%20a%20few%20days%20now%2C%20but%20I%20feel%20like%20I've%20just%20been%20working%20myself%20in%20a%20circle%2C%20so%20I'm%20here%20now%20to%20ask%20this%20to%20some%20people%20who%20actually%20know%20what%20they're%20doing.%20Anyway%2C%20my%20problem%20is%20this%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20an%20program%20that%20writes%20to%20the%20user's%20Documents%20folder.%20I'm%20using%20the%20KnownFolder%20section%20along%20with%20the%20Documents%20Folder%20GUID%20to%20try%20and%20redirect%20the%20program's%20writes%20to%20the%20Local%20AppData%20folder%2C%20but%20nothing%20I've%20tried%20has%20been%20able%20to%20stop%20the%20program's%20folder%20from%20appearing%20in%20regular%20Documents.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20included%20below%20the%20KnownFolder%20snippet%20straight%20from%20my%20config.json%20file.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%22knownFolders%22%3A%20%5B%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%22id%22%3A%20%22%7BF42EE2D3-909F-4907-8871-4C22FC0BF756%7D%22%2C%0A%20%20%20%20%20%20%20%20%22relativePaths%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22base%22%3A%20%22%22%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22patterns%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22.*%22%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%0A%5D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20guess%20my%20absolute%20question%20is%20whether%20or%20not%20this%20Fixup%20even%20has%20the%20capability%20to%20do%20this.%20Have%20I%20just%20misinterpreted%20what%20the%20File%20Redirection%20Fixup%20is%20for%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20hope%20my%20question%20has%20been%20clear%20enough%2C%20and%20I%20hope%20I%20can%20finally%20get%20a%20solution%20to%20my%20little%20conundrum%20here.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2111949%22%20slang%3D%22en-US%22%3ERe%3A%20PSF%20File%20Redirection%20Fixup%20Confusion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2111949%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146612%22%20target%3D%22_blank%22%3E%40TIMOTHY%20MANGAN%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOh%2C%20another%20thought.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20FRF%20can%20handle%20redirection%20of%20a%20file%20in%20the%20documents%20folder%20by%20using%20relative%20path%20within%20the%20config.json%20instead%20of%20KnownFolderId.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETim%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2111947%22%20slang%3D%22en-US%22%3ERe%3A%20PSF%20File%20Redirection%20Fixup%20Confusion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2111947%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F949780%22%20target%3D%22_blank%22%3E%40Edwinfitz%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ECurrently%2C%20the%20FRF%20does%20not%20support%20this.%26nbsp%3B%20Could%20it%3F%26nbsp%3B%20Sure.%26nbsp%3B%20I've%20added%20several%20other%20folders%20to%20that%20list%20in%20the%20past.%26nbsp%3B%20We%20have%20not%20included%20it%20because%20it%20seemed%20bad%20for%20the%20customers.%26nbsp%3B%20They%20might%20create%20a%20file%20in%20your%20app%20and%20then%20be%20unable%20to%20email%20to%20someone%20or%20use%20some%20other%20app%20with%20the%20file.%26nbsp%3B%20Thus%20the%20documents%20folder%20(as%20well%20as%20other%20places%20like%20the%20desktop)%20are%20currently%20not%20covered%20by%20the%20FRF.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EIf%20you%20can%20explain%20the%20scenario%20of%20how%20it%20is%20needed%2C%20we%20(well%2C%20probably%20I)%20can%20consider%20adding%20in%20support%20into%20the%20FRF.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ERegards%2C%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETim%20Mangan%20(not%20a%20Microsoft%20employee)%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2111780%22%20slang%3D%22en-US%22%3ERe%3A%20PSF%20File%20Redirection%20Fixup%20Confusion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2111780%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F146612%22%20target%3D%22_blank%22%3E%40TIMOTHY%20MANGAN%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20don't%20mind%20the%20folder%20being%20controlled%20by%20the%20FRF%2C%20but%20my%20main%20problem%20is%20that%20no%20matter%20what%20I%20try%20the%20FRF%20never%20seems%20to%20redirect%20the%20Folder%20being%20written%20to%20Documents%20in%20the%20first%20place.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20got%20this%20idea%20after%20reading%20the%20documentation%20for%20the%20File%20Redirection%20Fixup%2C%20where%20it%20states%20in%20the%20'id'%20section%20under%20'knownFolders'%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%22%3CSPAN%3EA%20string%20identifier%20indicating%20the%20input%20to%26nbsp%3B%3C%2FSPAN%3ESHGetKnownFolderPath%3CSPAN%3E.%20This%20can%20be%20one%20of%20the%20strings%20listed%20below%20or%20a%20string%20of%20the%20form%26nbsp%3B%3C%2FSPAN%3E%22%7BGUID%7D%22%3CSPAN%3E%26nbsp%3Bfor%20some%26nbsp%3B%3C%2FSPAN%3EKNOWNFOLDERID%3CSPAN%3E%26nbsp%3Bvalue.%22%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20to%20ask%20again%20if%20the%20FRF%20even%20has%20the%20capability%20to%20do%20this.%20I'm%20still%20a%20bit%20worried%20that%20I'm%20just%20running%20a%20fools%20errand%20here.%20Although%20thank%20you%20for%20bringing%20up%20package%20scripts%2C%20for%20some%20reason%20it%20never%20crossed%20my%20mind%20to%20try%20and%20use%20one%20for%20this%20manner.%20I'll%20try%20working%20with%20those%20if%20my%20initial%20question%20turns%20out%20to%20be%20impossible.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2111734%22%20slang%3D%22en-US%22%3ERe%3A%20PSF%20File%20Redirection%20Fixup%20Confusion%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2111734%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F949780%22%20target%3D%22_blank%22%3E%40Edwinfitz%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E1)%20If%20your%20package%20does%20not%20contain%20any%20documents%2C%20the%20end%20user%20would%20not%20need%20the%20Psf%2FFRF%20to%20be%20able%20to%20write%20there.%26nbsp%3B%20Only%20files%20contained%20in%20the%20folder%20paths%20of%20your%20package%20need%20help%20to%20allow%20write%20access.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E2)%20A%20quick%20review%20of%20the%20Psf%2FFileRedirection%20code%20shows%20that%20the%20Id%20field%20of%20the%20Json%20should%20not%20be%20the%20KnownFolderID%20Guid%2C%20but%20a%20name%20that%20is%20the%26nbsp%3BVFS%20folder%20equivalent%20of%20the%20file%20system.%26nbsp%3B%20The%20readme.md%20for%20the%20FileRedirection%20lists%20the%20id%20values%20supported%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fmicrosoft%2FMSIX-PackageSupportFramework%2Ftree%2Fmaster%2Ffixups%2FFileRedirectionFixup%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMSIX-PackageSupportFramework%2Ffixups%2FFileRedirectionFixup%20at%20master%20%C2%B7%20microsoft%2FMSIX-PackageSupportFramework%20(github.com)%3C%2FA%3E%26nbsp%3B%20and%20the%20code%20supports%20this%20list.%26nbsp%3B%20The%20Documents%20folder%20is%20not%20part%20of%20it.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E3)%20If%20there%20is%20a%20need%20to%20include%20files%20in%20the%20Documents%20folder%20in%20your%20package%2C%20I%20would%20recommend%20placing%20them%20elsewhere%20in%20the%20package%20and%20use%20a%20RunOnce%20package%20script%20from%20PsfLauncher%20that%20copies%20those%20files%20into%20the%20user's%20Documents%20folder%20the%20on%20the%20first%20run%20of%20the%20app.%26nbsp%3B%20You%20probably%20want%20all%20document%20files%20available%20to%20other%20apps%20and%20if%20the%20FRF%20controlled%20them%20they%20would%20be%20trapped%20in%20this%20app's%20container%20redirection%20area.%26nbsp%3B%20%3CSTRONG%3EIf%20you%20feel%20otherwise%2C%20please%20post%20some%20details%20so%20that%20we%20can%20better%20understand%20the%20scenario.%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New 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