'Returns list of pairs (source_file, destination) describing path
to work_dir output file and ultimate destination.'

def get_work_dir_outputs(self, job_wrapper, job_working_directory=None, tool_working_directory=None):

    if ((tool_working_directory is not None) and (job_working_directory is not None)):
        raise Exception('get_work_dir_outputs    called    with    both    a    job    and    tool    working    directory,    only    one    may    be    specified')
    if (tool_working_directory is None):
        if (not job_working_directory):
            job_working_directory = os.path.abspath(job_wrapper.working_directory)
        tool_working_directory = os.path.join(job_working_directory, 'working')
    output_paths = {}
    for dataset_path in job_wrapper.get_output_fnames():
        path = dataset_path.real_path
        if self.app.config.outputs_to_working_directory:
            path = dataset_path.false_path
        output_paths[dataset_path.dataset_id] = path
    output_pairs = []
    job = job_wrapper.get_job()
    job_tool = job_wrapper.tool
    for (joda, dataset) in self._walk_dataset_outputs(job):
        if (joda and job_tool):
            hda_tool_output = job_tool.find_output_def(joda.name)
            if (hda_tool_output and hda_tool_output.from_work_dir):
                source_file = os.path.join(tool_working_directory, hda_tool_output.from_work_dir)
                destination = job_wrapper.get_output_destination(output_paths[dataset.dataset_id])
                if in_directory(source_file, tool_working_directory):
                    output_pairs.append((source_file, destination))
                else:
                    log.exception('from_work_dir    specified    a    location    not    in    the    working    directory:    %s,    %s', source_file, job_wrapper.working_directory)
    return output_pairs
