+
Skip to content

fix: works when ran through a symlink #850

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

Merged
merged 2 commits into from
Aug 25, 2024
Merged

fix: works when ran through a symlink #850

merged 2 commits into from
Aug 25, 2024

Conversation

EDM115
Copy link
Contributor

@EDM115 EDM115 commented Aug 25, 2024

closes #849

I'll let you bump the version and create the executables
Successfully tested on Windows :
image
image

I only tried the built windows executable, but this shouldn't affect builds for other distros.
Also my knowledge in Perl is really the bare minimum so there could be a better way to write it or maybe some imports are duplicated. All I know is that it works :)

@EDM115
Copy link
Contributor Author

EDM115 commented Aug 25, 2024

also I didn't modified Unix/cloc but tbh I don't really know how this repo works 😅

@AlDanial
Copy link
Owner

Impressive. Thanks for making the effort to figure this out. I have one minor request: please move the line with
my $exec_path = abs_path($0); inside the if test for $ON_WINDOWS.

- also edited the file in Unix dir as I believe they shouldn't be different
- edited Unix/AUTHORS
@EDM115
Copy link
Contributor Author

EDM115 commented Aug 25, 2024

done 👍

Tip

If anyone still have issues, here's the built artifact for 2.02 :
cloc_#850_2.02.zip
VirusTotal check : https://www.virustotal.com/gui/file/44dab7d5936d3661535d86ab8b5d9c8186a63409bc59bdd0d1bad898c9266041 (akin to existing scans)

Don't trust me ? Wanna build it yourself ?

git clone https://github.com/AlDanial/cloc.git
cd cloc

(Needs to have Perl installed, like Strawberry Perl on Windows)

cpan -i Digest::MD5
cpan -i Regexp::Common
cpan -i Algorithm::Diff
cpan -i PAR::Packer
cpan -if Win32::LongPath

On latest Strawberry Perl versions this last one may fail so use this :

cpanm --notest Win32::LongPath
pp -M Win32::LongPath -M Encode::Unicode -M Digest::MD5 -c -x -o cloc.exe cloc

Copy-paste the .exe into %LOCALAPPDATA%\Microsoft\WinGet\Packages\AlDanial.Cloc_Microsoft.Winget.Source_8wekyb3d8bbwe\

@AlDanial AlDanial merged commit 1f11b89 into AlDanial:master Aug 25, 2024
1 check passed
@EDM115
Copy link
Contributor Author

EDM115 commented Feb 11, 2025

@EDM115
Copy link
Contributor Author

EDM115 commented Jun 29, 2025

Tip

2.06 built exe working with Winget (hopefully the last one) :
cloc_#850_2.06.zip
VirusTotal check : https://www.virustotal.com/gui/file/2f9a42449eba85a93b630ea0fb126a76f01c7790b5026ebf458c2705f31e39ce

@AlDanial
Copy link
Owner

Thanks. My plan for today is to create a sandbox cloc git repo and follow your instructions more carefully to create some releases and hopefully be able to create the identical Winget-friendly executable on my own.

@EDM115
Copy link
Contributor Author

EDM115 commented Jun 29, 2025

one thing that might work is setting up the dockur/windows image, which gives an usable windows instance. it can run on actions but they have a finite run time. codespaces works too but there's a limit per account and then it's paid
maybe there could be an action that launches it and sets up everything (post install script is available) so it clones and builds cloc from the latest version and it should work + give an usable windows session

however from what I saw when I tested this the VT scans are less forgiving (I did this method for the 2.06 build since I messed up my local strawberry perl)

I'll check that soon

@AlDanial
Copy link
Owner

I tried making a release with my new sandbox_cloc_release repo (after getting a VT token and adding it to my GH secrets) but am still seeing incomprehensible fails in the release step: https://github.com/AlDanial/sandbox_cloc_release/actions/runs/15959081362/job/45009169815 Baffling.

@AlDanial
Copy link
Owner

I was able to make a workflow to just create the Windows exe in my sandbox area, https://github.com/AlDanial/sandbox_cloc_release/actions/runs/15962700753/workflow. Curiously it has a different VirusTotal signature than yours:
https://www.virustotal.com/gui/file/bbe48de9102d0f2520d292d65897001c1d068340eb7cd74dd1ee30c1a9091c4a?nocache=1

I will upload this one to cloc's release area.

@EDM115
Copy link
Contributor Author

EDM115 commented Jul 2, 2025

yes, i got very surprised by this VT detection...
also you are able to get a smaller exe which is welcome ☺️

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

Successfully merging this pull request may close these issues.

[BUG] cloc won't work if ran through a symlink on Windows (ex Winget) : Can't locate PAR.pm in @INC
2 participants
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载