reitzig / ltx2any

Yet another LaTeX build wrapper, with one or two nifty features
GNU General Public License v3.0
59 stars 4 forks source link

Excessive Directory Nesting Issue in ltx2any.rb on Windows #125

Closed Foadsf closed 7 months ago

Foadsf commented 8 months ago

Description

As I have also explained here, I'm encountering an issue with the ltx2any.rb script, which creates excessively nested directories when running on Windows. This seems to occur during the execution of the copy2tmp method, which leads to a deeply nested directory structure like ../folderName/folderName/folderName/..., eventually causing a "No such file or directory" error.

The command I run is

ruby "C:\Users\Foo\OneDrive - Bar\Desktop\Apps\ltx2any\ltx2any.rb" -t build main.tex

and the error message I get is

[ltx2any] Copying files to tmp ... Error

[ltx2any] Error: No such file or directory @ dir_s_mkdir - build/../01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test/01_test
          See main.err for details.

Steps to Reproduce

  1. Run the ltx2any.rb script to process a LaTeX document.
  2. Observe the creation of deeply nested directories during the process.

What I Tried

Expected Behavior

The script should copy files to a temporary directory without creating an unnecessary nested structure.

Actual Behavior

The script creates a deeply nested directory path, resulting in a file system error due to the path length or structure.

Environment

Additional Information

I am attaching the modified ltx2any.rb script for reference. Any insights or suggestions to resolve this issue would be greatly appreciated.

Modified Script

Attachment: modified ltx2any.rb script

Foadsf commented 8 months ago

I just sent a pull request here that should solve this problem.

reitzig commented 7 months ago

Thanks for the report, and the PR!

FWIW, I find it hard to understand the issue from your description alone. An MWE would be appreciated or, failing that, a clear example. I can't run anything on Windows! đŸ˜…

That said, given the feedback other users provided on #126, I reckon this is a real issue and your fix looks good to me. Thanks!