Fix path prefix on windows

Previously, the path prefix was only set if "windows_paths" was true, regardless
of OS. Now the path prefix is always set on windows and never set on other OSes.
This commit is contained in:
Joscha 2021-05-25 14:21:52 +02:00
parent 22c2259adb
commit eb8b915813
2 changed files with 2 additions and 4 deletions

View File

@ -242,7 +242,6 @@ class Crawler(ABC):
config.default_section.working_dir() / section.output_dir(name),
section.redownload(),
section.on_conflict(),
section.windows_paths(),
)
@property

View File

@ -142,10 +142,9 @@ class OutputDirectory:
root: Path,
redownload: Redownload,
on_conflict: OnConflict,
windows_paths: bool,
):
if windows_paths:
# Windows limits the path length to 260 for some historical reason
if os.name == "nt":
# Windows limits the path length to 260 for some historical reason.
# If you want longer paths, you will have to add the "\\?\" prefix
# in front of your path. See:
# https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation