function openCompleted = openSupportingFile(workDir, metadata, fileName)
openCompleted = false;
[~, fileToOpen, ~] = fileparts(fileName);
for iFiles = 1:numel(metadata.files)
    f = metadata.files{iFiles};
    if isExecutableleFile(f.filename)
        [~, supportingFileName, ~] = fileparts(f.filename);
        % Compare without extension for dispatchable files.
        if strcmp(fileToOpen, supportingFileName)
            open(fullfile(workDir,f.filename))
            openCompleted = true;
            return;
        end
    else
        % Compare with extension for non-dispatchable files         
        if strcmp(fileName, f.filename)
            open(fullfile(workDir,f.filename))
            openCompleted = true;
            return;
        end
    end
end
end

function isExecutable = isExecutableleFile(filename)
isExecutable = false;
pattern = [".m", ".mlx", ".slx", ".sfx", ".sldd", ".mlapp"];
if endsWith(filename, pattern)
    isExecutable = true;
end
end