Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to read files with long paths on Windows using list-file #704

Closed
RyanMcC opened this issue Jan 6, 2023 · 4 comments
Closed

Unable to read files with long paths on Windows using list-file #704

RyanMcC opened this issue Jan 6, 2023 · 4 comments

Comments

@RyanMcC
Copy link
Contributor

RyanMcC commented Jan 6, 2023

Using the latest cloc 1.96 windows binary release, I'm still having trouble with long paths.

I'm using a list-file and have --no-recurse set, which is working in bypassing File::Find and the long-path problems associated with it. But I still get Unable to read errors for files with > 255 char paths.

It runs fine when I test it with the script instead though. I have Strawberry Perl v5.32.1, all the dependencies listed in the readme, and Win32::LongPath installed. Is the problem that Win32::LongPath isn't being shipped with the binary, so it's just falling back on the built-in file operators? If so, would it be possible to add it to the binary release?

@AlDanial
Copy link
Owner

AlDanial commented Jan 6, 2023

I didn't do anything different in building the exe for 1.96. Possibly the Win32::LongPath module must be explictly called out on compiling? Since you have Strawberry Perl you can try building your own executable with the steps below. The last command includes a call-out to use ``Win32::LongPath `:

C:> cpan -i Digest::MD5
C:> cpan -i Regexp::Common
C:> cpan -i Algorithm::Diff
C:> cpan -i PAR::Packer
C:> pp -M Win32::LongPath -M Digest::MD5 -c -x -o cloc-1.96.exe cloc-1.96.pl

If that works for you, I'll repeat the build and upload an updated .exe.

@RyanMcC
Copy link
Contributor Author

RyanMcC commented Jan 9, 2023

Ah, yeah that's the problem. Like with Digest::MD5 it's imported with eval "use Win32::LongPath;", which is probably why PAR::Packer doesn't pick up on it.

I tried the build command you gave, but then I was getting this error when I tried running it: Can't call method "encode" on an undefined value at .../lib/Win32/LongPath.pm line 1192. That was happening because LongPath uses Encode::find_encoding ('utf16-le'), which requires Encode::Unicode. I added that too, and now it's working correctly.

So the build command that worked for me is pp -M Win32::LongPath -M Encode::Unicode -M Digest::MD5 -c -x -o cloc-1.96.exe cloc-1.96.pl

@AlDanial
Copy link
Owner

Thanks for figuring this out for me! I'm squeezed for time this week but will update the exe (and README instructions) before the week is out.

@AlDanial
Copy link
Owner

Added the updated exe to a new release 1.96.1 and updated the exe build notes in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants