I'm calling an external script that generates (or regenerates) files from the DCRs attached to a task and then attaches the generated html to the workflow. I have it working when the DCR and html file live in the same folder. However when I try to change the directory of the generated html to "Current", the html file is no longer attached to the workflow.
Here is the section of the task that I changed:
my $generatedFile_dir = "$areapath/Current/";
my $ofile = "$generatedFile_dir$dcr_name.shtml";
And here is the addtask section:
#---------------------------------------------------------------------
# addFiles
# Add generated files to the task.
#
# ARGUMENTS
# $task - The task (TeamSite::WFtask)
# $areapath - The areapath.
#
@generatedFiles# RETURNS
# Nothing. Works by side-effect on $task.
#---------------------------------------------------------------------
sub addFiles
{
my ($task, $areapath,
@generatedFiles) =
@_;
# Add generated files to the task, locking if necessary.
my
@currentFiles= $task->GetFiles();
for my $genFile (
@generatedFiles) {
# Add the file (if it is not already attached)
# We want the area relative path!
$genFile =~ s/^$areapath/Current//;
$genFile =~ s/^\///; # Remove the leading slash.
$genFile =~ s/\//\\/g if ($^O eq "MSWin32"); # Reverse slashes
next if grep { $genFile eq $_ }
@currentFiles;
debug("AddFile: $genFile");
$task->AddFile($genFile, "Generated by Workflow");
}
}