BringDAUserFile: FileProc = {
out: STREAM = NARROW [data];
localName: ROPE = DFUtilities.RemoveVersionNumber[name];
BEGIN
attachedTo: ROPE;
created: BasicTime.GMT;
[attachedTo: attachedTo, created: created] ← FS.FileInfo[name: localName, remoteCheck: FALSE ! FS.Error => GOTO Copy]; -- if the file is inexistent, we copy it!
IF attachedTo=NIL THEN {out.PutF["File %g NOT copied from %g: local version exists.\n", IO.rope[name], IO.rope[from]]; RETURN};
IF created=date.gmt THEN RETURN; -- already there
IF LOOPHOLE[created, INT]>LOOPHOLE[date.gmt, INT] THEN {out.PutF["File %g NOT copied from %g: local version more recent.\n", IO.rope[name], IO.rope[from]]; RETURN};
GOTO Copy;
EXITS
Copy => [] ←
FS.Copy[
to: localName, from: Rope.Cat[from, name], wantedCreatedTime: date.gmt, attach: TRUE
! FS.Error => out.PutF["File %g could NOT be copied from %g: %g.\n", IO.rope[localName], IO.rope[from], IO.rope[error.explanation]];
];
END;
};
BringDAUserImport: ImportProc = {
RETURN [
IF Rope.Match["/DATools/*", dfName]
OR Rope.Match["[DATools]*", dfName]
THEN all
ELSE public]};