Reputation: 86146
Is there an API available for this in .Net? What about in the Windows API? If not, has anyone come up with some hackish-way to do this yet?
Upvotes: 5
Views: 2117
Reputation: 489
Finding the local storage folder of a Windows 8 Style application
The path to Windows 8 Style apps is as follows:
C:\Users\{username}\AppData\Local\Packages\Microsoft.BingSports_8wekyb3d8bbwe
There is a new Windows API which uses an internal and undisclosed algorithm to create a publisher hash, which when appended to the package name becomes the family name. Family name looks like {packagename}_{publisherhash}
If you wanted another desktop application or need to share this between some set of applications you can call the API via PowerShell cmdlet like so:
(Get-AppxPackage -AllUsers -Name $name).PackageFamilyName
Write that to the registry and voila! Your application can use Environment.UserName and the path pattern above to easily find your appx local storage.
Upvotes: 3