I am trying to open the a file explorer from the following code:
:- pce_autoload(toc_window, library(pce_toc)).
:- pce_autoload(report_dialog, library(pce_report)).
:- pce_begin_class(explorer, frame, "Explore the filesystem").
initialise(E, Dir:directory) :->
"Explore from directory"::
send_super(E, initialise, 'Simple explorer'),
send(E, append, new(DH, directory_hierarchy(Dir))),
send(new(view), right, DH),
send(new(report_dialog), below, DH).
open_node(E, Node:file) :->
"Show file content of opened node"::
get(E, member, view, View),
send(View, load, Node).
:- pce_end_class.
:- pce_begin_class(directory_hierarchy, toc_window,
"Browser for a directory-hierarchy").
initialise(FB, Root:directory) :->
send(FB, send_super, initialise),
get(Root, name, Name),
send(FB, root, toc_folder(Name, Root)).
expand_node(FB, D:directory) :->
"Called if a node is to be expanded"::
new(SubDirsNames, chain),
new(FileNames, chain),
send(D, scan, FileNames, SubDirsNames),
get(SubDirsNames, map, ?(D, directory, @arg1), SubDirs),
send(SubDirs, for_all,
message(FB, son, D,
create(toc_folder, @arg1?name, @arg1))),
get(FileNames, map, ?(D, file, @arg1), SubFiles),
send(SubFiles, for_all,
message(FB, son, D,
create(toc_file, @arg1?base_name, @arg1))).
open_node(FB, Node:file) :->
"Called if a file is double-clicked"::
send(FB?frame, open_node, Node).
:- pce_end_class.
file_explorer(Dir) :-
new(E, explorer),
send(E,initialise,Dir),
send(E, open).
When I try to open with ?- file_explorer('.'). I get the error "ERROR: explorer ->initialise: Missing argument 1 (directory): `directory' expected".
I get the same error if I try something like ?- file_explorer(directory(.)). Can anybody explain what I'm doing wrong--what incantation do I use to open the explorer on a given directory?
Thanks!