2
3:- module(logicmoo_packages,[ rescan_pack_autoload_packages/0]). 4
8:- use_module(library(prolog_pack)). 9:- if( \+ prolog_pack:current_pack(logicmoo_base)). 10:- multifile(user:file_search_path/2). 11:- dynamic(user:file_search_path/2). 12:- prolog_load_context(directory,Dir),
13 absolute_file_name('../../',Y,[relative_to(Dir),file_type(directory)]),
14 (( \+ user:file_search_path(pack,Y)) ->asserta(user:file_search_path(pack,Y));true). 15:- initialization(attach_packs,now). 16:- pack_list_installed. 17:- endif. 18
19
20
22:- dmsg("AUTOLOAD PACKAGES"). 24
34
35
36rescan_pack_autoload_packages:- \+ access_file('.',write),dmsg("READONLY PACKAGES"),!.
37rescan_pack_autoload_packages:- \+ app_argv('--all'),!.
38rescan_pack_autoload_packages:- dmsg("AUTOLOADING PACKAGES..."),
39 forall('$pack':pack(Pack, _),
40 forall(((pack_property(Pack, directory(PackDir)),prolog_pack:pack_info_term(PackDir,autoload(true)))),
41 (access_file(PackDir,write) -> prolog_pack:post_install_autoload(PackDir, [autoload(true)]) ; true))),
42 dmsg(".. AUTOLOADING COMPLETE"),!.
43
44:- before_boot(rescan_pack_autoload_packages). 45:- during_boot(rescan_pack_autoload_packages). 46
47
50:- reload_library_index.