<<>> <> <> <> <> <> 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] --GetTimeProc-- ~ { 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.