| 1 | :- module(tools_io,[safe_open_file/4]). | |
| 2 | ||
| 3 | :- use_module(module_information). | |
| 4 | :- module_info(group,infrastructure). | |
| 5 | :- module_info(description,'This module contains file io helper predicates.'). | |
| 6 | ||
| 7 | :- use_module(error_manager). | |
| 8 | ||
| 9 | safe_open_file(Filename,Mode,Stream,Options) :- | |
| 10 | %print(opening(Filename)),nl, | |
| 11 | on_exception(error(A,B),open(Filename,Mode,Stream,Options), | |
| 12 | (add_error(open_file,'Exception occurred opening file: ',error(A,B)),fail)). |