MakeDoFiles.Mesa
Copyright Ó 1991 by Xerox Corporation. All rights reserved.
Last Edited by: Spreitzer, February 20, 1986 10:01:12 pm PST
JKF January 11, 1989 10:10:14 am PST
Eduardo Pelegri-Llopart March 17, 1989 8:41:25 am PST
Last tweaked by Mike Spreitzer on October 6, 1992 11:16 am PDT
DIRECTORY
FS USING [ComponentPositions, Error, ExpandName, FileInfo],
MakeDo USING [DeclareNodeClass, existsFSWatch, Node, NodeClass, notExistTime, PublicPartsOfNode, Time],
MakeDoPorting USING [StartFSWatchers],
Rope USING [ROPE, Substr];
MakeDoFiles:
CEDAR
MONITOR
IMPORTS FS, MakeDo, MakeDoPorting, Rope
EXPORTS MakeDo
=
BEGIN OPEN MakeDo;
ROPE: TYPE = Rope.ROPE;
fileClass:
PUBLIC NodeClass ¬ DeclareNodeClass[
name: "file",
CanonizeName: CannonizeFileName,
GetInfo: GetFileInfo
];
CannonizeFileName:
PROC [random:
ROPE]
RETURNS [canonical:
ROPE] = {
ENABLE FS.Error => {canonical ¬ random; CONTINUE};
full: ROPE;
cp: FS.ComponentPositions;
[full, cp] ¬ FS.ExpandName[random];
canonical ¬ full.Substr[len: cp.ext.start + cp.ext.length];
};
GetFileInfo:
PUBLIC
PROC [n: Node]
RETURNS [created: Time, length:
INT]
--GetInfoProc-- ~ {
name: ROPE = n.PublicPartsOfNode[].name;
[created: created, bytes: length] ¬
FS.FileInfo[name: name, remoteCheck:
TRUE
--we need this to get the byte count, which we need to check for broken attachments-- !
FS.Error =>
{created ¬ notExistTime; CONTINUE}];
IF length = -1 THEN created ¬ notExistTime;
RETURN};
IF existsFSWatch THEN MakeDoPorting.StartFSWatchers[];
END.