summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDan Fandrich <dan@coneharvesters.com>2023-04-10 17:28:09 -0700
committerDan Fandrich <dan@coneharvesters.com>2023-04-11 14:55:32 -0700
commit8e75c4f978e548855dc90e63a948454de7650b79 (patch)
treeeb9d19d694fe16b0e082f447c09d7b29a24788f4 /tests
parentdef8dc80715506dd2e236582a3b06a02bf58c951 (diff)
downloadcurl-8e75c4f978e548855dc90e63a948454de7650b79.tar.gz
pathhelp: use the cached $use_cygpath when available
Diffstat (limited to 'tests')
-rw-r--r--tests/pathhelp.pm15
1 files changed, 6 insertions, 9 deletions
diff --git a/tests/pathhelp.pm b/tests/pathhelp.pm
index 5dcd986a2..7d924b862 100644
--- a/tests/pathhelp.pm
+++ b/tests/pathhelp.pm
@@ -65,7 +65,6 @@ BEGIN {
sys_native_current_path
build_sys_abs_path
normalize_path
- $use_cygpath
should_use_cygpath
drives_mounted_on_cygdrive
);
@@ -97,21 +96,19 @@ BEGIN {
}
}
-our $use_cygpath; # Only for Win32:
+my $use_cygpath; # Only for Win32:
# undef - autodetect
- # 1 - use cygpath
# 0 - do not use cygpath
+ # 1 - use cygpath
# Returns boolean true if 'cygpath' utility should be used for path conversion.
sub should_use_cygpath {
- if(!os_is_win()) {
+ return $use_cygpath if defined $use_cygpath;
+ if(os_is_win()) {
+ $use_cygpath = (qx{cygpath -u '.\\' 2>/dev/null} eq "./\n" && $? == 0);
+ } else {
$use_cygpath = 0;
- return 0;
}
- return $use_cygpath if defined $use_cygpath;
-
- $use_cygpath = (qx{cygpath -u '.\\' 2>/dev/null} eq "./\n" && $? == 0);
-
return $use_cygpath;
}