Skip to content

Long paths on Windows lead to errors due to shutil limitations #156

@Rubyfi

Description

@Rubyfi

Describe the bug
The bug occurs when shutil is trying to delete files with really long paths whilte the EnableLongPaths registry entry is not set.

  File "...\Python310\Lib\site-packages\doxysphinx\utils\files.py", line 143, in copy_if_different
    shutil.copy(source_file, target_file)
  File "shutil.py", line 417, in copy
  File "shutil.py", line 256, in copyfile
FileNotFoundError: [Errno 2] No such file or directory: 'super\duper\long\path\filename_icgraph.map'

To Reproduce
Steps to reproduce the behavior:

  • Create a really long base path for your project (>260 characters)
  • Run doxygen
  • Run doxysphinx

Expected behavior
The file shuld be handled properly.

Desktop (please complete the following information):

  • OS: Windows 10

Additional context
This can be solved enabling long file paths programmatically: https://burgaud.com/path-too-long/
I was able to fix the issue transforming the paths if running doxysphinx on Windows:

files.py:135 ff

    result: List[Path] = []
    for file in files_to_copy:
        source_file = file
        target_file = target_dir / source_file.relative_to(source_dir)
        target_file.parent.mkdir(parents=True, exist_ok=True)
        if os.name == 'nt':
            source_file = r"\\?\%s" % source_file
            target_file = r"\\?\%s" % target_file

        shutil.copy(source_file, target_file)
        result.append(target_file)

    return result

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions