app_dir(?quoted_atom)

This built-in predicate determines the directory of the program executing the current Prolog program and matches it with the argument. If the argument is not empty and the Prolog program is running on Microsoft Windows then the match between the argument and the current directory is case insensitive.

see also: app_dir/1 base64_decode_file/2 base64_encode_file/2 compress_file/2 copy_file/2 current_dir/1 decompress_file/1 decompress_file/2 decrypt_file/3 delete_file/1 encrypt_file/3 exists_dir/1 exists_file/1 info_file/2 make_dir/1 md5_file/2 next_file/2 next_file/3 next_dir/2 remove_dir/1 rename_file/2 set_current_dir/1 split_fn/2 unlink_file/1 wipe_file/1

Examples
app_dir('c:\\test\\prolog\\'). If the program executing the current Prolog program is located in the directory 'c:\\test\\prolog\\  then the predicate exits, else it fails.
app_dir(Cur). The variable Cur is matched with for instance the value 'c:\\test\\prolog\\'.

 

Exceptions
The argument is an empty variable an instantiation_error exception is thrown
The argument Arg is not an atom enclosed by single or double quotes a type_error(atom_singlequotes, Arg) exception is thrown
The application directory could not be determined a system_error(get_app, directory, A) exception is thrown

 

 

info@trinc-prolog.com