Even simpler, you can use absolute_file_name(pack(''), Dir)
and let absolute_file_name
expand the pack
directory alias. (The only difference this way is that Dir
will have a trailing slash, but that shouldn’t matter in most cases.)
1 Like
I always use
?- absolute_file_name(pack('.'), Dir).
Dir = '/home/janw/.local/share/swi-prolog/pack'.
Note that if you use absolute_file_name/3, we can use this to enumerate all possible locations for the packs:
?- absolute_file_name(pack('.'), Dir, [file_type(directory), access(write), solutions(all)]).
2 Likes