+ $last = '' if($last eq '.');
+
+ if($last eq '..')
+ {
+ $first = upper_path($first);
+ $last = '';
+ }
+ elsif($^O eq 'MSWin32' && $last =~ m!^\.\.\.+$!)
+ {
+ # Windows allows to go upwards in a path using things like
+ # "..." and "...." and so on
+
+ for(my $x=0;$x<length($last)-1;$x++)
+ {
+ unless($first =~ m!^[a-z]{1}:(/|\\)$!i)
+ {
+ $first = upper_path($first);
+ }
+ }
+
+ $last = '';
+ }