Skip to content
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

File::Spec::Win32->catfile returns 'x:\file' instead of 'x:file' #165

Closed
p5pRT opened this issue Jul 7, 1999 · 1 comment
Closed

File::Spec::Win32->catfile returns 'x:\file' instead of 'x:file' #165

p5pRT opened this issue Jul 7, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Jul 7, 1999

Migrated from rt.perl.org#970 (status was 'resolved')

Searchable as RT970$

@p5pRT
Copy link
Author

p5pRT commented Jul 7, 1999

From als@turnhere.com

in DOS-ish systems, notation 'X​:file' means 'file in _current_
directory on drive X​:'. File​::Spec->catfile( 'X​:', 'file')
returns
'X​:\file', which means 'file in root directory on drive X​:'.

following patch for Win32.pm (from File​::Spec 0.7) fixes this
problem​:

*** Win32.pm.orig Fri Feb 20 09​:42​:02 1998
--- Win32.pm Wed Jul 07 20​:01​:07 1999
***************
*** 40,51 ****
 
  sub catdir {
  my $self = shift;
  my @​args = @​_;
  for (@​args) {
  # append a slash to each argument unless it has one there
  $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
  }
! my $result = $self->canonpath(join('', @​args));
  $result;
  }
 
--- 40,53 ----
 
  sub catdir {
  my $self = shift;
+ my $first =shift;
  my @​args = @​_;
+ $first .= "\\" if $first !~ /^[a-z]​:$|\\$/i;
  for (@​args) {
  # append a slash to each argument unless it has one there
  $_ .= "\\" if $_ eq '' or substr($_,-1) ne "\\";
  }
! my $result = $self->canonpath(join('', $first, @​args));
  $result;
  }
 
***************
*** 62,68 ****
  return $file unless @​_;
  my $dir = $self->catdir(@​_);
  $dir =~ s/(\\\.)$//;
! $dir .= "\\" unless substr($dir,length($dir)-1,1) eq "\\";
  return $dir.$file;
  }
 
--- 64,70 ----
  return $file unless @​_;
  my $dir = $self->catdir(@​_);
  $dir =~ s/(\\\.)$//;
! $dir .= "\\" unless $dir =~ /^[a-z]​:$|\\$/i;
  return $dir.$file;
  }
 

Perl Info


Site configuration information for perl 5.00503:

Summary of my perl5 (5.0 patchlevel 5 subversion 03)
configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86
    uname=''
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-g -O2 ', gccversion=
    cppflags='-DWIN32'
    ccflags ='-g -O2  -mno-cygwin -DWIN32  -DHAVE_DES_FCRYPT
-I/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/include/mingw32
-I/usr/local/include'
    stdchar='char', d_stdstdio=undef, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=undef, longlongsize=8, d_longdbl=define,
longdblsize=12
    alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='
-L"/cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66"
-Wl,--strip-debug -mno-cygwin'
   
libpth=/cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66
/usr/local/lib
    libs=-ldes -ladvapi32 -luser32 -lnetapi32 -lwsock32 -lmingw32
-lgcc -lmoldname -lcrtdll -lkernel32 -liberty
    libc=-lcrtdll, so=dll, useshrplib=yes, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll 
-L"/cygnus/cygwin-b20/H-i586-cygwin32/lib/gcc-lib/i586-cygwin32/egcs-2.91.66"
-Wl,--strip-debug -mno-cygwin'

Locally applied patches:
    


@INC for perl 5.00503:
    E:\usr\perl\5.00503\lib/MSWin32-x86
    E:\usr\perl\5.00503\lib
    E:\usr\perl\site\5.00503\lib/MSWin32-x86
    E:\usr\perl\site\5.00503\lib
    .


Environment for perl 5.00503:
    HOME=E:\
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=E:\Program
Files\Far;E:\ORANT\bin;E:\usr\perl\5.00503\bin;E:\usr\local\bin;E:\usr\bin;E:\cygnus\CYGWIN~1\H-I586~1\bin;E:\WINNT\system32;E:\WINNT;C:\Tools;E:\USR\TEXMF\MIKTEX\BIN;E:\usr\X11R6.4\bin;C:\DOS;C:\VC;\UTILITY
    PERL_BADLANG (unset)
    SHELL (unset)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant