There is the current_prolog_flag/2 predicate, see here. Towards the top you see an example of writing Windows-specific code. The relevant keys are I guess windows, apple, unix?
For each OS there is only one choice available. the predicate must be called with an unbound variable though.
I added a third clause with a default file name without path info, assuming that it would create the log file in any default folder where prolog is running – so at least the system won’t fail – hopefully.
(If there were no choice point, you wouldn’t see the false.)
You can avoid the choice point by either using the if-then-else style or by adding cuts as follows (the cut in the 2nd clause isn’t necessary, but makes it easier to add a 3rd clause, for example with a default or to throw an error):
(Also, I would suggest using ~ instead of /home/user on Unix, to make it easier for other people to use your code … absolute_file_name/2 and friends can also be useful.)
Good advice by Peter. Also look for expand_file_name/2 to expand ~ and $VAR and, on Windows, win_folder/2 that allows you to find the well known places on Windows.