Skip to content

Commit 2ac1442

Browse files
committed
fix: avoid trying to copy shapes that have been moved by the word-to-dtbook script
1 parent bf228ce commit 2ac1442

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

Common/DaisyConverterLib/Pipeline/Pipeline2/Scripts/WordToDtbook.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,15 @@ public override void ExecuteScript(string inputPath)
293293
if(ExtractedShapes.Count > 0) {
294294
foreach (string shape in ExtractedShapes)
295295
{
296-
File.Copy(shape, Path.Combine(Parameters["output"].Value.ToString(), Path.GetFileName(shape)), true);
296+
if(File.Exists(shape) == false) {
297+
// File has been already copied by the new word to dtbook script, continue parsing
298+
continue;
299+
}
300+
try {
301+
File.Copy(shape, Path.Combine(Parameters["output"].Value.ToString(), Path.GetFileName(shape)), true);
302+
} catch(Exception ex) {
303+
EventsHandler.onProgressMessageReceived(this, new DaisyEventArgs("Error while copying extracted shape "+shape+": "+ex.Message));
304+
}
297305
}
298306
}
299307
}

0 commit comments

Comments
 (0)