I’m currently looking for a way for my (external .exe) addon to automatically find the community folder.
In case the user has not set a custom location, this is obviously pretty easy, as there are only a few options.
However, if the user has a custom Community Folder location, I couldn’t find a solution except asking the user for the location manually. Which is obviously not and ideal user-experience.
I noticed that ‘Simstaller’ by //42 is able to detect the community path automatically, so it seems to be possible.
I’m not looking for a specific implementation, just an idea where to find that information.
Is there maybe a file where the folder is defined? Or a registry entry?
In the MSFS SDK, you can find this Visual Studio solution: \Samples\VisualStudio\PackageInstaller\PackageInstaller.sln.
Upon opening it, you will see that it contains two projects, one being named DetectMSFS. In its CustomAction.cpp file, you will find a function named FindCommunityFolder which should help.
The basic steps are:
Locate “UserCfg.opt” - its location varies depending on wether you are using a Microsoft Store or Steam version of the sim
Parse the file to extract the value of InstalledPackagesPath