diff --git a/src/model/ExternalFile.cpp b/src/model/ExternalFile.cpp index b8825c40825..931f5d34ad0 100644 --- a/src/model/ExternalFile.cpp +++ b/src/model/ExternalFile.cpp @@ -220,15 +220,17 @@ namespace model { // we expect all strings to be UTF-8 encoded path p = toPath(filename); - if (!exists(p)) { - boost::optional op = workflow.findFile(filename); - if (!op) { - this->remove(); - LOG_AND_THROW("Cannot find file \"" << filename << "\" for " << this->briefDescription()); + if (copyFile || !p.is_relative()) { + if (!exists(p)) { + boost::optional op = workflow.findFile(filename); + if (!op) { + this->remove(); + LOG_AND_THROW("Cannot find file \"" << filename << "\" for " << this->briefDescription()); + } + p = op.get(); } - p = op.get(); + OS_ASSERT(exists(p)); } - OS_ASSERT(exists(p)); bool ok; if (copyFile) {