When you install Opus for the first time you're given the choice of private or shared configuration. If you choose shared (i.e., all users of the machine have the same configuration) then the config files will be in ProgramData instead of AppData.
You can check the value of config_type in %APPDATA%\GPSoftware\Directory Opus\userdata.omd to see whether "private" or "shared" is selected.
The value should always be there, if it's not the user will be asked next time they start the program what type of config they want (i.e. it'll be treated as a new install, as far as I know).
We could add a API to query it but I think at the moment the only way would be to find the main Opus window (there's always a hidden "main" window if Opus is running), then check the folder which the exe for that process is in to see if it contains config files.
Situations where Opus is installed portable are probably also ones where people wouldn't be able to install QAP, so it might not be worth worrying about, but we can add a proper way to query it (e.g. via a window message) if one is needed.
QAP can also be installed in portable mode (from a ZIP file) and run from an USB key, etc. Around 10% of QAP users use it that way. Every favorite path can be relative to the running directory, use system variables, etc.
Would this other approach work? QAP user has to specify the DOpus program folder in its configuration. If the folder "[DOpus Exe Folder]\ConfigFiles" exists, this would be a portable installation?
What is the content of config_type="shared" in userdata.omd when running portable?
I think it would say "private" but it would also be in the same folder as the other config files in a portable install (the aim is for no config data to be written outside of the program folder in that situation) so you'd already know it was a portable install by the time you found the config file. (Or you'd be looking at a config file from an unrelated non-portable install. It's always possible to run the portable version on a machine that also has Opus, potentially a different version, installed normally but not running.)
Here are my findings when DOPus is exported to an external drive.
\ (root of the external drive)
DOPUS.exe (157 KB) -> Launcher only, this is NOT the executable path to enter in QAP config
DOPUS.ini (portable settings, irrelevant for QAP)
\DOPUS
dopus.exe (27 MB) -> this is the executable path to enter in QAP config
DOpusRt.exe -> found by QAP in the same folder as dopus.exe
userdata.omd in (irrelevant for QAP in this situation)
\DOPUS\ConfigFiles
favorites.ofv (created at first execution, unless user exported the configuration)
\DOPUS\Layouts
order.xml (created at first execution, unless user exported the configuration)
If user exported both 32-bit and 64-bit to the external drive, the 32-bit executables (only) are in this subfolder
\DOPUS\x86
dopus.exe (27 MB) -> this can be the executable to enter in QAP config
DOpusRt.exe -> found by QAP in the same folder as dopus.exe
If the folder [DOpus Exe Folder]\ConfigFiles exists, this would be a portable installation?
I think this assumptions is still good. This would be the first test. If it fails, QAP will look in the %APPDATA%\GPSoftware\Directory Opus\userdata.omd as suggested earlier in this thread to determine if config is under %APPDATA% or %PROGRAMDATA%.
As far as I can see, I think I have all the info I need to proceed. Thanks.
That looks correct. The only thing I'd add is not to use the drive root or need dopus.exe to be there, as there's an option to use the USB stick as just a dongle, and copy the program and config files to another drive (e.g. because the USB stick might be really slow, and the user has read-write access to a faster drive even though they don't have access to install software).
Noted. QAP will not use the root. It will use the path of the dopus.exe file specified by the user in QAP config. If the user enters the path of the dopus.exe file in the external drive root (the launcher), QAP will check if dopusrt.exe also exists in the same folder. If not, it will return an error.
If the DOpus portable files on another drive\directory (dongle scenario), user will only have to enter in the QAP config the path to the folder where dopus.exe and dopusrt.exe are.
(The other method, the path to the exe that created the main window, can be used for both installed and portable Opus, as long as Opus is running, of course.)
Good to know. It is better than what QAP currently does when you first install it: tt looks for %ProgramFiles%\GPSoftware\Directory Opus\dopus.exe (probably the most common location). If it is there it suggest user to enable it. If it is not found, user can enter the path in QAP config. I'll use this registry key instead.