From 1e27a4d77fbb58732ad7735f06280655979d61e7 Mon Sep 17 00:00:00 2001 From: Dan Howe Date: Tue, 21 Aug 2018 07:55:21 +1000 Subject: [PATCH] Add support for folder paths longer than 255 characters (Windows) --- major_projects_grabber/major_projects_grabber.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/major_projects_grabber/major_projects_grabber.py b/major_projects_grabber/major_projects_grabber.py index 21e62ef..69f349b 100644 --- a/major_projects_grabber/major_projects_grabber.py +++ b/major_projects_grabber/major_projects_grabber.py @@ -77,7 +77,12 @@ def get_document_list(mod_id, output_dir): # Create modification folder mod_dir = os.path.join(output_dir, project_name, mod_name) - os.makedirs(mod_dir, exist_ok=True) + try: + os.makedirs(mod_dir, exist_ok=True) + except FileNotFoundError: + # Fix destination path if longer than 255 characters (Windows only) + mod_dir = '\\\\?\\' + os.path.abspath(mod_dir) + os.makedirs(mod_dir, exist_ok=True) # Add note if no documents are found on portal if not folders: