From eb8b91581386f4d9dbd14b685c875f3376b29162 Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 25 May 2021 14:21:52 +0200 Subject: [PATCH] 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. --- PFERD/crawl/crawler.py | 1 - PFERD/output_dir.py | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/PFERD/crawl/crawler.py b/PFERD/crawl/crawler.py index 8bd29ad..420d088 100644 --- a/PFERD/crawl/crawler.py +++ b/PFERD/crawl/crawler.py @@ -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 diff --git a/PFERD/output_dir.py b/PFERD/output_dir.py index 5f65316..fa7babe 100644 --- a/PFERD/output_dir.py +++ b/PFERD/output_dir.py @@ -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