8000 fix: works when ran through a symlink by EDM115 · Pull Request #850 · AlDanial/cloc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Unix/AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ https://github.com/Inventitech
https://github.com/zhangzqs
https://github.com/drkameleon
https://github.com/jackos
https://github.com/Aerek-Yasa
https://github.com/Aerek-Yasa
https://github.com/EDM115
13 changes: 13 additions & 0 deletions Unix/cloc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,19 @@ if ($ON_WINDOWS and $ENV{'SHELL'}) {
}
}

use Cwd "abs_path";
use File::Spec;
# Fix for issues when runing cloc through a symlink on Windows
# e.g. : it have been installed with Winget
# See https://github.com/AlDanial/cloc/issues/849
if ($ON_WINDOWS) {
my $exec_path = abs_path($0);
if (-l $0) {
$exec_path = abs_path(readlink($0));
}
$0 = $exec_path;
}

my $HAVE_Win32_Long_Path = 0;
# Win32::LongPath is an optional dependency that when available on
# Windows will be used to support reading files past the 255 char
Expand Down
13 changes: 13 additions & 0 deletions cloc
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,19 @@ if ($ON_WINDOWS and $ENV{'SHELL'}) {
}
}

use Cwd "abs_path";
use File::Spec;
# Fix for issues when runing cloc through a symlink on Windows
# e.g. : it have been installed with Winget
# See https://github.com/AlDanial/cloc/issues/849
if ($ON_WINDOWS) {
my $exec_path = abs_path($0);
if (-l $0) {
$exec_path = abs_path(readlink($0));
}
$0 = $exec_path;
}

my $HAVE_Win32_Long_Path = 0;
# Win32::LongPath is an optional dependency that when available on
# Windows will be used to support reading files past the 255 char
Expand Down
0