Originally I altered my SWI-Prolog INI file to change to my projects directory upon startup when I launched SWI-Prolog from the task bar:
% Change to ME sub-directory.
:-
NewDir = '~/ME/',
working_directory(OldCwd, NewDir),
write('Old directory - '), write(OldCwd), nl,
write('New directory - '), write(NewDir), nl.
This works fine. However, there are now certain Prolog projects that I want to start by double-clicking on the main Prolog source file in the Explorer window, for example the PEngines project. When using this context, I don’t want to change to a different working directory upon startup because that will interfere with the path expectations of the project launched from the Explorer window when I double-click on its run.pl file.
How can I structure my SWI-Prolog INI file to handle this multi-context scenario and suppress the altering of the current working directory if I detect that SWI-Prolog was launched with a specific Prolog source file from a specific directory?