Arbortext Command Language > Functions by Alphabetical Listing > path_doc
  
path_doc
path_doc (path)
This function searches the list of open documents for the path name given by path, which may be the name of a document directory or a plain file, and returns the corresponding document identifier if found, or -1 if not. If path does not specify an absolute path name, the current directory is prepended.
Examples
This function can be written using other built-ins as follows:
function path_doc(name) {
local i, n, L[], path
path = absolute_file_name(name);
if (file_directory(path)) {
path .= "/" . basename(name) . ".sgm"
}
n = doc_list(L)
for (i = 1; i <= n; i++) {
if (path == doc_path(L[i])) {
return L[i];
}
}
return -1;
}