Refactor symlink usage to support Windows

This commit is contained in:
James R. Barlow
2019-12-04 17:13:51 -08:00
parent 17c419dfcb
commit 72d3ee3a87
6 changed files with 20 additions and 13 deletions
+2 -2
View File
@@ -30,7 +30,7 @@ from ..exceptions import (
SubprocessOutputError,
TesseractConfigError,
)
from ..helpers import page_number
from ..helpers import page_number, safe_symlink
from . import get_version
OrientationConfidence = namedtuple('OrientationConfidence', ('angle', 'confidence'))
@@ -324,7 +324,7 @@ def use_skip_page(text_only, skip_pdf, output_pdf, output_text):
# Substitute a "skipped page"
with suppress(FileNotFoundError):
os.remove(output_pdf) # In case it was partially created
os.symlink(skip_pdf, output_pdf)
safe_symlink(skip_pdf, output_pdf)
return
# Or normally, just write a 0 byte file to the output to indicate a skip