Consider the following code:
print cwd . "\n"; $str= "../source";
If my current directory is c:\parentdir\Source (note the capital "S"), the output of this will be:
c: / parentdir / Source
c: / parentdir / source
This causes problems in my routine, which takes care of the correct case of folder names. $ str is passed to my subroutine, so I cannot know in advance whether it has the correct case. How to determine the correct path name that matches $str ?
More details here:
- I understand that
../source is a pathological example, but it serves to illustrate the problem. This happens even if $str asks for a folder other than the current one. - I tried many options, including
rel2abs , glob search on $str and others, but all of them seem to return " source " instead of " source ". - I could look for
$str/.. for all directories, convert them all to absolute paths and compare them with the version of the absolute path $str , but this seems like a hack. I was hoping for something more elegant.
Craig source share